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.

EmergencyExit.cs 1.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Preparation.Interface;
  2. using Preparation.Utility;
  3. namespace GameClass.GameObj
  4. {
  5. /// <summary>
  6. /// 紧急出口
  7. /// </summary>
  8. public class EmergencyExit : GameObj
  9. {
  10. public EmergencyExit(XY initPos) :
  11. base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.EmergencyExit)
  12. {
  13. this.CanMove = false;
  14. }
  15. public override bool IsRigid => true;
  16. public override ShapeType Shape => ShapeType.Square;
  17. public override bool IgnoreCollideExecutor(IGameObj targetObj)
  18. {
  19. if (!canOpen) return true;
  20. if (!IsOpen) return false;
  21. if (targetObj.Type != GameObjType.Character)
  22. return true; // 非玩家不碰撞
  23. return false;
  24. }
  25. private bool canOpen = false;
  26. public bool CanOpen
  27. {
  28. get => canOpen;
  29. set
  30. {
  31. lock (gameObjLock)
  32. canOpen = value;
  33. }
  34. }
  35. private bool isOpen = false;
  36. public bool IsOpen
  37. {
  38. get => isOpen;
  39. set
  40. {
  41. lock (gameObjLock)
  42. isOpen = value;
  43. }
  44. }
  45. }
  46. }