using System.Collections.Generic; using Ragdoll; using UnityEngine; namespace Game { public class CockFactory : ScriptSingleton { private readonly Dictionary _cockPrefabDict = new Dictionary() { { 1, "Cock/prefab_cock_1" }, { 2, "Cock/prefab_cock_2" }, { 3, "Cock/prefab_cock_3" }, { 4, "Cock/prefab_cock_4" }, { 5, "Cock/prefab_cock_5" }, { 6, "Cock/prefab_cock_6" }, { 7, "Cock/prefab_cock_7" }, }; public GameObject GenerateCockPrefab(int cockId) { var cockExist = _cockPrefabDict.TryGetValue(cockId, out var path); Debug.LogWarning("获取斗鸡模型 " + cockId + " 结果 " + cockExist); var prefab = Resources.Load(path); return prefab; } } }