public virtual void SetTile(Vector3Int location, GridTile tile, Rotation rotation)
    {
        SetTile(location, tile);
        DirectionalTile directionalTile = (DirectionalTile)tile;

        directionalTile.SetRotation(rotation);
    }
Ejemplo n.º 2
0
    public void ChangeRotation(int times)
    {
        Vector3 mousePos = Input.mousePosition;

        mousePos.z = -Camera.main.transform.localPosition.z;
        Vector3 worldPoint = Camera.main.ScreenToWorldPoint(mousePos);

        Vector3Int overlayPos = MouseToTilePos(overlay);

        int x = (int)rotation;

        x += times;
        if (x >= Enum.GetValues(typeof(Rotation)).GetLength(0))
        {
            x -= Enum.GetValues(typeof(Rotation)).GetLength(0);
        }

        if (x < 0)
        {
            x += Enum.GetValues(typeof(Rotation)).GetLength(0);
        }
        rotation = (Rotation)x;

        if (grid.GetTile(overlayPos) is DirectionalTile)
        {
            DirectionalTile tile = (DirectionalTile)grid.GetTile(overlayPos);
            tile.SetRotation(rotation);
        }

        Debug.Log(rotation);
    }
    public override void SetTile(Vector3Int location, GridTile tile)
    {
        DirectionalTile directionalTile = (DirectionalTile)tile;

        tiles[location] = directionalTile;
        directionalTile.transform.SetParent(this.transform);
        // if (directionalTile.name.IndexOf("(Clone)") > -1) {
        //     directionalTile.name = directionalTile.name.Substring(0, directionalTile.name.IndexOf("(Clone)")) + location;
        // }
        directionalTile.SetRotation(Rotation.NORTH);
        UpdateNeighbors(location);
    }