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.2 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 => !isOpen;
  17. public override ShapeType Shape => ShapeType.Square;
  18. private bool isOpen = true;
  19. public bool IsOpen
  20. {
  21. get => isOpen;
  22. set
  23. {
  24. lock (gameObjLock)
  25. isOpen = value;
  26. }
  27. }
  28. private int openOrLockDegree = 0;
  29. public int OpenOrLockDegree
  30. {
  31. get => openOrLockDegree;
  32. set
  33. {
  34. if (value > 0)
  35. lock (gameObjLock)
  36. openOrLockDegree = (value > GameData.degreeOfLockingOrOpeningTheDoor) ? GameData.degreeOfLockingOrOpeningTheDoor : value;
  37. else
  38. lock (gameObjLock)
  39. openOrLockDegree = 0;
  40. }
  41. }
  42. }
  43. }