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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.place = PlaceType.EmergencyExit;
  14. this.CanMove = false;
  15. }
  16. public override bool IsRigid => true;
  17. public override ShapeType Shape => ShapeType.Square;
  18. public override bool IgnoreCollideExecutor(IGameObj targetObj)
  19. {
  20. if (!canOpen) return true;
  21. if (!IsOpen) return false;
  22. if (targetObj.Type != GameObjType.Character)
  23. return true; // 非玩家不碰撞
  24. return false;
  25. }
  26. private bool canOpen = false;
  27. public bool CanOpen
  28. {
  29. get => canOpen;
  30. set
  31. {
  32. lock (gameObjLock)
  33. canOpen = value;
  34. }
  35. }
  36. private bool isOpen = false;
  37. public bool IsOpen
  38. {
  39. get => isOpen;
  40. set
  41. {
  42. lock (gameObjLock)
  43. isOpen = value;
  44. }
  45. }
  46. }
  47. }