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

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