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

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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.CanMove = false;
  14. }
  15. public override bool IsRigid => true;
  16. public override ShapeType Shape => ShapeType.Square;
  17. private Prop[] propInChest = new Prop[GameData.maxNumOfPropInChest] { new NullProp(), new NullProp() };
  18. public Prop[] PropInChest => propInChest;
  19. private int openStartTime = 0;
  20. public int OpenStartTime => openStartTime;
  21. private Character? whoOpen = null;
  22. public Character? WhoOpen => whoOpen;
  23. public void Open(int startTime, Character character)
  24. {
  25. lock (gameObjLock)
  26. {
  27. openStartTime = startTime;
  28. whoOpen = character;
  29. }
  30. }
  31. public void StopOpen()
  32. {
  33. lock (gameObjLock)
  34. {
  35. openStartTime = 0;
  36. whoOpen = null;
  37. }
  38. }
  39. }
  40. }