You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Gadget.cs 5.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. using Preparation.Interface;
  2. using Preparation.Utility;
  3. using System.Threading;
  4. namespace GameClass.GameObj
  5. {
  6. public abstract class Gadget : ObjOfCharacter
  7. {
  8. public override bool IsRigid => true;
  9. public override bool IgnoreCollideExecutor(IGameObj targetObj)
  10. {
  11. if (targetObj.Type == GameObjType.Gadget || targetObj.Type == GameObjType.Bullet
  12. || targetObj.Type == GameObjType.Character || targetObj.Type == GameObjType.Chest)
  13. return true;
  14. return false;
  15. }
  16. public override ShapeType Shape => ShapeType.Square;
  17. public abstract PropType GetPropType();
  18. public Gadget(XY initPos, int radius = GameData.PropRadius) :
  19. base(initPos, radius, GameObjType.Gadget)
  20. {
  21. this.canMove = false;
  22. this.MoveSpeed = GameData.PropMoveSpeed;
  23. }
  24. }
  25. public abstract class Tool : Gadget
  26. {
  27. private bool isUsed = false;
  28. public bool IsUsed
  29. {
  30. get
  31. {
  32. lock (gameObjLock)
  33. return isUsed;
  34. }
  35. set
  36. {
  37. lock (gameObjLock)
  38. {
  39. isUsed = value;
  40. }
  41. }
  42. }
  43. public Tool(XY initPos) : base(initPos) { }
  44. }
  45. public abstract class Consumables : Gadget
  46. {
  47. public Consumables(XY initPos) : base(initPos) { }
  48. }
  49. ///// <summary>
  50. ///// 坑人地雷
  51. ///// </summary>
  52. // public abstract class DebuffMine : Gadget
  53. //{
  54. // public DebuffMine(XYPosition initPos) : base(initPos) { }
  55. // }
  56. #region 所有增益道具
  57. /// <summary>
  58. /// 增加速度
  59. /// </summary>
  60. public sealed class AddSpeed : Consumables
  61. {
  62. public AddSpeed(XY initPos) :
  63. base(initPos)
  64. {
  65. }
  66. public override PropType GetPropType() => PropType.AddSpeed;
  67. }
  68. /// <summary>
  69. /// 复活甲
  70. /// </summary>
  71. public sealed class AddLifeOrClairaudience : Consumables
  72. {
  73. public AddLifeOrClairaudience(XY initPos) :
  74. base(initPos)
  75. {
  76. }
  77. public override PropType GetPropType() => PropType.AddLifeOrClairaudience;
  78. }
  79. public sealed class AddHpOrAp : Consumables
  80. {
  81. public AddHpOrAp(XY initPos) :
  82. base(initPos)
  83. {
  84. }
  85. public override PropType GetPropType() => PropType.AddHpOrAp;
  86. }
  87. public sealed class RecoveryFromDizziness : Consumables
  88. {
  89. public RecoveryFromDizziness(XY initPos) :
  90. base(initPos)
  91. {
  92. }
  93. public override PropType GetPropType() => PropType.RecoveryFromDizziness;
  94. }
  95. /// <summary>
  96. /// 矛盾
  97. /// </summary>
  98. public sealed class ShieldOrSpear : Consumables
  99. {
  100. public ShieldOrSpear(XY initPos) : base(initPos)
  101. {
  102. }
  103. public override PropType GetPropType() => PropType.ShieldOrSpear;
  104. }
  105. #endregion
  106. public sealed class Key3 : Tool
  107. {
  108. public Key3(XY initPos) : base(initPos)
  109. {
  110. }
  111. public override PropType GetPropType() => PropType.Key3;
  112. }
  113. public sealed class Key5 : Tool
  114. {
  115. public Key5(XY initPos) : base(initPos)
  116. {
  117. }
  118. public override PropType GetPropType() => PropType.Key5;
  119. }
  120. public sealed class Key6 : Tool
  121. {
  122. public Key6(XY initPos) : base(initPos)
  123. {
  124. }
  125. public override PropType GetPropType() => PropType.Key6;
  126. }
  127. public sealed class NullProp : Gadget
  128. {
  129. public NullProp() : base(new XY(1, 1))
  130. {
  131. }
  132. public override PropType GetPropType() => PropType.Null;
  133. }
  134. // #region 所有坑人地雷
  135. ///// <summary>
  136. ///// 减速
  137. ///// </summary>
  138. // public sealed class MinusSpeed : DebuffMine
  139. //{
  140. // public MinusSpeed(XYPosition initPos) : base(initPos) { }
  141. // public override PropType GetPropType() => PropType.minusSpeed;
  142. // }
  143. ///// <summary>
  144. ///// 减少攻击力
  145. ///// </summary>
  146. // public sealed class MinusAP : DebuffMine
  147. //{
  148. // public MinusAP(XYPosition initPos) : base(initPos) { }
  149. // public override PropType GetPropType() => PropType.minusAP;
  150. // }
  151. ///// <summary>
  152. ///// 增加冷却
  153. ///// </summary>
  154. // public sealed class AddCD : DebuffMine
  155. //{
  156. // public AddCD(XYPosition initPos) : base(initPos) { }
  157. // public override PropType GetPropType() => PropType.addCD;
  158. // }
  159. // #endregion
  160. public static class PropFactory
  161. {
  162. public static Gadget GetConsumables(PropType propType, XY pos)
  163. {
  164. switch (propType)
  165. {
  166. case PropType.AddSpeed:
  167. return new AddSpeed(pos);
  168. case PropType.AddLifeOrClairaudience:
  169. return new AddLifeOrClairaudience(pos);
  170. case PropType.ShieldOrSpear:
  171. return new ShieldOrSpear(pos);
  172. case PropType.AddHpOrAp:
  173. return new AddHpOrAp(pos);
  174. case PropType.RecoveryFromDizziness:
  175. return new RecoveryFromDizziness(pos);
  176. case PropType.Key3:
  177. return new Key3(pos);
  178. case PropType.Key5:
  179. return new Key5(pos);
  180. case PropType.Key6:
  181. return new Key6(pos);
  182. default:
  183. return new NullProp();
  184. }
  185. }
  186. }
  187. }