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.

Chest.cs 1.2 kB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Preparation.Utility;
  2. using System.Collections.Generic;
  3. namespace GameClass.GameObj
  4. {
  5. /// <summary>
  6. /// 箱子
  7. /// </summary>
  8. public class Chest : GameObj
  9. {
  10. public Chest(XY initPos) :
  11. base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Chest)
  12. {
  13. this.place = PlaceType.Chest;
  14. this.CanMove = false;
  15. }
  16. public override bool IsRigid => true;
  17. public override ShapeType Shape => ShapeType.Square;
  18. private Prop[] propInChest = new Prop[GameData.maxNumOfPropInChest] { new NullProp(), new NullProp() };
  19. public Prop[] PropInChest => propInChest;
  20. private int openDegree = 0;
  21. public int OpenDegree
  22. {
  23. get => openDegree;
  24. set
  25. {
  26. if (value > 0)
  27. lock (gameObjLock)
  28. openDegree = (value > GameData.degreeOfOpeningChest) ? GameData.degreeOfOpeningChest : value;
  29. else
  30. lock (gameObjLock)
  31. openDegree = 0;
  32. }
  33. }
  34. public bool IsOpen() => (OpenDegree == GameData.degreeOfOpeningChest);
  35. }
  36. }