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.

Door.cs 1.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Preparation.Interface;
  2. using Preparation.Utility;
  3. namespace GameClass.GameObj
  4. {
  5. /// <summary>
  6. /// 门
  7. /// </summary>
  8. public class Door : GameObj
  9. {
  10. public Door(XY initPos, PlaceType placeType) :
  11. base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Door)
  12. {
  13. this.place = placeType;
  14. this.CanMove = false;
  15. }
  16. public override bool IsRigid => true;
  17. public override ShapeType Shape => ShapeType.Square;
  18. protected override bool IgnoreCollideExecutor(IGameObj targetObj)
  19. {
  20. return isOpen;
  21. }
  22. private bool isOpen = false;
  23. public bool IsOpen
  24. {
  25. get => isOpen;
  26. set
  27. {
  28. lock (gameObjLock)
  29. isOpen = value;
  30. }
  31. }
  32. private int openOrLockDegree = 0;
  33. public int OpenOrLockDegree
  34. {
  35. get => openOrLockDegree;
  36. set
  37. {
  38. lock (gameObjLock)
  39. openOrLockDegree = (value > 0) ? value : 0;
  40. }
  41. }
  42. }
  43. }