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.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 openStartTime = 0;
  21. public int OpenStartTime => openStartTime;
  22. private Character? whoOpen = null;
  23. public Character? WhoOpen => whoOpen;
  24. public void Open(int startTime, Character character)
  25. {
  26. lock (gameObjLock)
  27. {
  28. openStartTime = startTime;
  29. whoOpen = character;
  30. }
  31. }
  32. public void StopOpen()
  33. {
  34. lock (gameObjLock)
  35. {
  36. openStartTime = 0;
  37. whoOpen = null;
  38. }
  39. }
  40. }
  41. }