Ejemplo n.º 1
0
    public void MoveTile(string input, Player player)
    {
        if (!CanMove)
        {
            return;
        }
        TileBase tile = player.CurrentTile;
        int      NewY = 0;

        switch (input)
        {
        case "up":
            NewY = 180;
            if (player.CurrentTile.UpTile != null)
            {
                player.transform.localEulerAngles = new Vector3(0, NewY, 0);
                tile = player.CurrentTile.UpTile;
            }
            break;

        case "down":
            if (player.CurrentTile.DownTile != null)
            {
                player.transform.localEulerAngles = new Vector3(0, NewY, 0);
                tile = player.CurrentTile.DownTile;
                //0
            }
            break;

        case "left":
            NewY = 90;
            if (player.CurrentTile.LeftTile != null)
            {
                player.transform.localEulerAngles = new Vector3(0, NewY, 0);
                tile = player.CurrentTile.LeftTile;
                //90
            }
            break;

        case "right":
            NewY = 270;
            if (player.CurrentTile.RightTile != null)
            {
                player.transform.localEulerAngles = new Vector3(0, NewY, 0);
                tile = player.CurrentTile.RightTile;
            }
            break;
        }

        player.CurrentTile.Players.Remove(player);
        player.CurrentTile.OrganizePlayers();
        tile.Players.Insert(0, player);
        tile.OrganizePlayers();

        Transform NewTileTrans = tile.PlayerSpots[0].transform;

        LeanTween.move(player.gameObject, tile.PlayerSpots[0].position, 0.1f);
        LeanTween.move(camera.gameObject, new Vector3(NewTileTrans.position.x, camera.transform.position.y, NewTileTrans.position.z + 5f), 0.1f);
        player.CurrentTile = tile;
    }