Ejemplo n.º 1
0
    public bool move(char move)
    {
        switch (move)
        {
        case 'n':
            if (playerTile.GetTileNorth() != null && playerTile.GetTileNorth().IsWalkAble())
            {
                updateNewPlayerTile(playerTile.GetTileNorth());
                return(true);
            }
            return(false);

        case 's':
            if (playerTile.GetTileSouth() != null && playerTile.GetTileSouth().IsWalkAble())
            {
                updateNewPlayerTile(playerTile.GetTileSouth());
                return(true);
            }
            return(false);

        case 'e':
            if (playerTile.GetTileEast() != null && playerTile.GetTileEast().IsWalkAble())
            {
                updateNewPlayerTile(playerTile.GetTileEast());
                return(true);
            }
            return(false);

        case 'w':
            if (playerTile.GetTileWest() != null && playerTile.GetTileWest().IsWalkAble())
            {
                updateNewPlayerTile(playerTile.GetTileWest());
                return(true);
            }
            return(false);

        default:
            Debug.Log("invalid command passed to move function");
            return(false);
        }
    }