示例#1
0
 public bool Close()
 {
     if (collidableComponent.TryCollision(Vector2.Zero))
     {
         // Do nothing, somebody's in the door.
         return(false);
     }
     Opened          = false;
     OpenTimeCounter = 0;
     collidableComponent.IsHardCollidable = true;
     return(true);
 }
示例#2
0
        public bool Close()
        {
            if (collidableComponent.TryCollision(Vector2.Zero))
            {
                // Do nothing, somebody's in the door.
                return(false);
            }

            _state = DoorState.Closing;
            collidableComponent.IsHardCollidable = true;
            OpenTimeCounter = 0;
            _appearance.SetData(DoorVisuals.VisualState, DoorVisualState.Closing);

            Timer.Spawn(CloseTime, () =>
            {
                _state = DoorState.Closed;
                _appearance.SetData(DoorVisuals.VisualState, DoorVisualState.Closed);
            });
            return(true);
        }