Пример #1
0
        public override void UpdateGraphicsToMatchSurroundings()
        {
            int       useHorizontal = 0;
            int       x             = Location.X;
            int       y             = Location.Y;
            TileField tileField     = Parent as TileField;

            if (tileField.GetTile(x, y - 1) is WallTile)
            {
                useHorizontal -= 1;
            }
            if (tileField.GetTile(x + 1, y) is WallTile)
            {
                useHorizontal += 1;
            }
            if (tileField.GetTile(x, y + 1) is WallTile)
            {
                useHorizontal -= 1;
            }
            if (tileField.GetTile(x - 1, y) is WallTile)
            {
                useHorizontal += 1;
            }
            if (useHorizontal <= -1)
            {
                sprite          = new SpriteSheet("VerticalDoor");
                secondarySprite = new SpriteSheet("VerticalDoorOverlay");
                isHorizontal    = false;
            }
            else
            {
                sprite          = new SpriteSheet("HorizontalDoor");
                secondarySprite = new SpriteSheet("HorizontalDoorOverlay");
            }
        }
Пример #2
0
        public override bool IsActionForbiddenFromHere(ITileFieldPlayer player, PlayerAction action)
        {
            if (!TileField.GetTile(Location + lastDirection.ToPoint()).StopsSliding)
            {
                return(false);
            }

            return(base.IsActionForbiddenFromHere(player, action));
        }
Пример #3
0
 public override void PerformAction(ITileFieldPlayer player, PlayerAction action)
 {
     if (!TileField.GetTile(Location + lastDirection.ToPoint()).StopsSliding)
     {
         player.MoveSmoothly(lastDirection);
     }
     else
     {
         base.PerformAction(player, action);
     }
 }
Пример #4
0
 /// <summary>
 /// Checks if this tile prevents a player who is currently at this Tile from performing the specified action
 /// </summary>
 /// <param name="player">The player at this Tile that wants to perform the action</param>
 /// <param name="action">The action to check</param>
 /// <returns>true if the action is forbidden by this Tile. false otherwise.</returns>
 public virtual bool IsActionForbiddenFromHere(ITileFieldPlayer player, PlayerAction action)
 {
     return(action == PlayerAction.SPECIAL || !TileField.GetTile(GetLocationAfterAction(action)).CanPlayerMoveHere(player));
 }