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.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. protected 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, PlaceType place, int radius = GameData.PropRadius) :
  18. base(initPos, radius, GameObjType.Prop)
  19. {
  20. this.place = place;
  21. this.CanMove = false;
  22. this.moveSpeed = GameData.PropMoveSpeed;
  23. }
  24. }
  25. ///// <summary>
  26. ///// 坑人地雷
  27. ///// </summary>
  28. // public abstract class DebuffMine : Prop
  29. //{
  30. // public DebuffMine(XYPosition initPos) : base(initPos) { }
  31. // }
  32. #region 所有增益道具
  33. /// <summary>
  34. /// 增加速度
  35. /// </summary>
  36. public sealed class AddSpeed : Prop
  37. {
  38. public AddSpeed(XY initPos, PlaceType placeType) :
  39. base(initPos, placeType)
  40. {
  41. }
  42. public override PropType GetPropType() => PropType.AddSpeed;
  43. }
  44. /// <summary>
  45. /// 复活甲
  46. /// </summary>
  47. public sealed class AddLifeOrClairaudience : Prop
  48. {
  49. public AddLifeOrClairaudience(XY initPos, PlaceType placeType) :
  50. base(initPos, placeType)
  51. {
  52. }
  53. public override PropType GetPropType() => PropType.AddLifeOrClairaudience;
  54. }
  55. public sealed class AddHpOrAp : Prop
  56. {
  57. public AddHpOrAp(XY initPos, PlaceType placeType) :
  58. base(initPos, placeType)
  59. {
  60. }
  61. public override PropType GetPropType() => PropType.AddHpOrAp;
  62. }
  63. /// <summary>
  64. /// 矛盾
  65. /// </summary>
  66. public sealed class ShieldOrSpear : Prop
  67. {
  68. public ShieldOrSpear(XY initPos, PlaceType placeType) : base(initPos, placeType)
  69. {
  70. }
  71. public override PropType GetPropType() => PropType.ShieldOrSpear;
  72. }
  73. public sealed class Key3 : Prop
  74. {
  75. public Key3(XY initPos, PlaceType placeType) : base(initPos, placeType)
  76. {
  77. }
  78. public override PropType GetPropType() => PropType.Key3;
  79. }
  80. public sealed class Key5 : Prop
  81. {
  82. public Key5(XY initPos, PlaceType placeType) : base(initPos, placeType)
  83. {
  84. }
  85. public override PropType GetPropType() => PropType.Key5;
  86. }
  87. public sealed class Key6 : Prop
  88. {
  89. public Key6(XY initPos, PlaceType placeType) : base(initPos, placeType)
  90. {
  91. }
  92. public override PropType GetPropType() => PropType.Key6;
  93. }
  94. public sealed class NullProp : Prop
  95. {
  96. public NullProp(PlaceType placeType = PlaceType.Wall) : base(new XY(1, 1), placeType)
  97. {
  98. }
  99. public override PropType GetPropType() => PropType.Null;
  100. }
  101. #endregion
  102. // #region 所有坑人地雷
  103. ///// <summary>
  104. ///// 减速
  105. ///// </summary>
  106. // public sealed class MinusSpeed : DebuffMine
  107. //{
  108. // public MinusSpeed(XYPosition initPos) : base(initPos) { }
  109. // public override PropType GetPropType() => PropType.minusSpeed;
  110. // }
  111. ///// <summary>
  112. ///// 减少攻击力
  113. ///// </summary>
  114. // public sealed class MinusAP : DebuffMine
  115. //{
  116. // public MinusAP(XYPosition initPos) : base(initPos) { }
  117. // public override PropType GetPropType() => PropType.minusAP;
  118. // }
  119. ///// <summary>
  120. ///// 增加冷却
  121. ///// </summary>
  122. // public sealed class AddCD : DebuffMine
  123. //{
  124. // public AddCD(XYPosition initPos) : base(initPos) { }
  125. // public override PropType GetPropType() => PropType.addCD;
  126. // }
  127. // #endregion
  128. public static class PropFactory
  129. {
  130. public static Prop GetProp(PropType propType, XY pos, PlaceType place)
  131. {
  132. switch (propType)
  133. {
  134. case PropType.AddSpeed:
  135. return new AddSpeed(pos, place);
  136. case PropType.AddLifeOrClairaudience:
  137. return new AddLifeOrClairaudience(pos, place);
  138. case PropType.ShieldOrSpear:
  139. return new ShieldOrSpear(pos, place);
  140. case PropType.AddHpOrAp:
  141. return new AddHpOrAp(pos, place);
  142. case PropType.Key3:
  143. return new Key3(pos, place);
  144. case PropType.Key5:
  145. return new Key5(pos, place);
  146. case PropType.Key6:
  147. return new Key6(pos, place);
  148. default:
  149. return new NullProp();
  150. }
  151. }
  152. }
  153. }