CockFactory.cs 894 B

12345678910111213141516171819202122232425262728
  1. using System.Collections.Generic;
  2. using Ragdoll;
  3. using UnityEngine;
  4. namespace Game
  5. {
  6. public class CockFactory : ScriptSingleton<CockFactory>
  7. {
  8. private readonly Dictionary<int, string> _cockPrefabDict = new Dictionary<int, string>()
  9. {
  10. { 1, "Cock/prefab_cock_1" },
  11. { 2, "Cock/prefab_cock_2" },
  12. { 3, "Cock/prefab_cock_3" },
  13. { 4, "Cock/prefab_cock_4" },
  14. { 5, "Cock/prefab_cock_5" },
  15. { 6, "Cock/prefab_cock_6" },
  16. { 7, "Cock/prefab_cock_7" },
  17. };
  18. public GameObject GenerateCockPrefab(int cockId)
  19. {
  20. var cockExist = _cockPrefabDict.TryGetValue(cockId, out var path);
  21. Debug.LogWarning("获取斗鸡模型 " + cockId + " 结果 " + cockExist);
  22. var prefab = Resources.Load<GameObject>(path);
  23. return prefab;
  24. }
  25. }
  26. }