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.
|
- using Preparation.Interface;
- using Preparation.Utility;
-
- namespace GameClass.GameObj
- {
- /// <summary>
- /// 出口
- /// </summary>
- public class Window : GameObj
- {
- public Window(XY initPos) :
- base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Window)
- {
- this.place = PlaceType.Window;
- this.CanMove = false;
- }
- public override bool IsRigid => true;
- public override ShapeType Shape => ShapeType.Square;
- protected override bool IgnoreCollideExecutor(IGameObj targetObj)
- {
- if (targetObj.Type != GameObjType.Character)
- return true; // 非玩家不碰撞
- else if (!((Character)targetObj).IsGhost())
- return true; // 不是鬼不碰撞
- return false;
- }
-
- private bool powerSupply = false;
- public bool PowerSupply
- {
- get => powerSupply;
- set
- {
- lock (gameObjLock)
- powerSupply = value;
- }
- }
-
- private bool isOpening = false;
- public bool IsOpening
- {
- get => isOpening;
- set
- {
- lock (gameObjLock)
- isOpening = value;
- }
- }
-
- private int openDegree = 0;
- public int OpenDegree
- {
- get => openDegree;
- set
- {
- if (value > 0)
- lock (gameObjLock)
- openDegree = (value < GameData.degreeOfOpenedDoorway) ? value : GameData.degreeOfOpenedDoorway;
- else
- lock (gameObjLock)
- openDegree = 0;
- }
- }
-
- public bool IsOpen() => (OpenDegree == GameData.degreeOfOpenedDoorway);
- }
- }
|