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

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Preparation.Utility;
  2. namespace GameClass.GameObj
  3. {
  4. /// <summary>
  5. /// 箱子
  6. /// </summary>
  7. public class Chest : Tile
  8. {
  9. public Chest(XY initPos) :
  10. base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Chest)
  11. {
  12. this.CanMove = false;
  13. }
  14. public override bool IsRigid => true;
  15. public override ShapeType Shape => ShapeType.Square;
  16. private readonly Prop[] propInChest = new Prop[GameData.maxNumOfPropInChest] { new NullProp(), new NullProp() };
  17. public Prop[] PropInChest => propInChest;
  18. private int openStartTime = 0;
  19. public int OpenStartTime => openStartTime;
  20. private Character? whoOpen = null;
  21. public Character? WhoOpen => whoOpen;
  22. public void Open(int startTime, Character character)
  23. {
  24. lock (GameObjReaderWriterLock)
  25. {
  26. openStartTime = startTime;
  27. whoOpen = character;
  28. }
  29. }
  30. public void StopOpen()
  31. {
  32. lock (GameObjReaderWriterLock)
  33. {
  34. openStartTime = 0;
  35. whoOpen = null;
  36. }
  37. }
  38. }
  39. }