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.

Prop.cs 5.5 kB

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