BaseTrainInfo.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. namespace ShotSimulator.Train.Info
  6. {
  7. [Serializable]
  8. public enum TrainType
  9. {
  10. Cognition, //认知
  11. Reaction, //反应
  12. Perceive, //觉察
  13. Accuracy, //精准度
  14. Speed, //速度
  15. Track, //追踪
  16. Customize, //自定义
  17. }
  18. public enum TrainTaskFinishType
  19. {
  20. /// <summary>
  21. /// 时间
  22. /// </summary>
  23. Time,
  24. /// <summary>
  25. /// 子弹数
  26. /// </summary>
  27. BulletNums,
  28. /// <summary>
  29. /// 次数
  30. /// </summary>
  31. Number,
  32. /// <summary>
  33. /// 自定义
  34. /// </summary>
  35. Customize
  36. }
  37. [Serializable]
  38. public class TrainTaskDetail
  39. {
  40. public string nameID;
  41. public string detailID;
  42. public string iconAssetPath;
  43. public Sprite showTexAssetPath;
  44. }
  45. public class BaseTrainInfo : ScriptableObject
  46. {
  47. public TrainType trainType;
  48. public TrainTaskType trainTaskType;
  49. public TrainTaskDetail detail;
  50. public string trainHandleClassName;
  51. public TrainTaskFinishType finishType;
  52. public int maxNumber;
  53. public TrainFirearmConfig m_TrainFirearmConfig;
  54. public int duration;
  55. public string environmentScene;
  56. public bool bgm;
  57. public CursorType cursorType;
  58. public List<MetricsInfo> metrics = new List<MetricsInfo>();
  59. [SerializeReference]
  60. public List<BaseDifficultyData> difficultyDatas = new List<BaseDifficultyData>();
  61. [SerializeReference]
  62. public List<BaseScoreData> scoreDatas = new List<BaseScoreData>();
  63. public virtual void ConfigDifficultyData()
  64. {
  65. difficultyDatas.Clear();
  66. }
  67. public virtual void ConfigScoreData()
  68. {
  69. scoreDatas.Clear();
  70. }
  71. protected void AddDifficultyData<T>() where T : BaseDifficultyData, new()
  72. {
  73. difficultyDatas.Add(new T() { difficultyType = DifficultyType.Standard });
  74. difficultyDatas.Add(new T() { difficultyType = DifficultyType.Advance });
  75. difficultyDatas.Add(new T() { difficultyType = DifficultyType.Professional });
  76. }
  77. protected void AddScoreData<T>() where T : BaseScoreData, new()
  78. {
  79. scoreDatas.Add(new T() { difficultyType = DifficultyType.Standard });
  80. scoreDatas.Add(new T() { difficultyType = DifficultyType.Advance });
  81. scoreDatas.Add(new T() { difficultyType = DifficultyType.Professional });
  82. }
  83. public T GetDifficultyData<T>(DifficultyType type) where T : BaseDifficultyData
  84. {
  85. T data = null;
  86. for(int i = 0; i < difficultyDatas.Count; i++)
  87. {
  88. if (difficultyDatas[i].difficultyType == type)
  89. {
  90. data = difficultyDatas[i] as T;
  91. }
  92. }
  93. return data;
  94. }
  95. public T GetScoreData<T>(DifficultyType type) where T : BaseScoreData
  96. {
  97. T data = null;
  98. for (int i = 0; i < scoreDatas.Count; i++)
  99. {
  100. if (scoreDatas[i].difficultyType == type)
  101. {
  102. data = scoreDatas[i] as T;
  103. }
  104. }
  105. return data;
  106. }
  107. }
  108. }