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

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