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.

Doorway.cs 1.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Preparation.Interface;
  2. using Preparation.Utility;
  3. namespace GameClass.GameObj
  4. {
  5. /// <summary>
  6. /// 出口
  7. /// </summary>
  8. public class Doorway : GameObj
  9. {
  10. public Doorway(XY initPos) :
  11. base(initPos, GameData.numOfPosGridPerCell / 2, PlaceType.Null, GameObjType.Doorway)
  12. {
  13. this.CanMove = false;
  14. }
  15. public override bool IsRigid => true;
  16. public override ShapeType Shape => ShapeType.Square;
  17. protected override bool IgnoreCollideExecutor(IGameObj targetObj)
  18. {
  19. if (targetObj.Type != GameObjType.Character)
  20. return true; // 非玩家不碰撞
  21. else if (!((Character)targetObj).IsGhost())
  22. return true; // 不是鬼不碰撞
  23. return false;
  24. }
  25. private bool powerSupply = false;
  26. public bool PowerSupply
  27. {
  28. get => powerSupply;
  29. set
  30. {
  31. lock (gameObjLock)
  32. powerSupply = value;
  33. }
  34. }
  35. public bool IsOpen => powerSupply;
  36. }
  37. }