示例#1
0
    private void RotateTileAtCoords(Vector3Int _coords)
    {
        int   i   = GetListIndexFromCoords(_coords);
        float rot = hexTiles[i].rot;

        rot             = SyrfusMath.Mod(rot + 60.0f, 360.0f);
        hexTiles[i].rot = rot;
        Matrix4x4 matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, rot), Vector3.one);

        hexTileMap.SetTransformMatrix(_coords, matrix);
    }
示例#2
0
    private bool HasNeighbor(Vector3Int _coords)
    {
        Vector3Int[] directions;
        if (SyrfusMath.Mod(_coords.y, 2) == 0)
        {
            directions = GetDirectionsEven(_coords);
        }
        else
        {
            directions = GetDirectionsOdd(_coords);
        }

        foreach (Vector3Int direction in directions)
        {
            if (hexTileMap.HasTile(direction))
            {
                return(true);
            }
        }
        return(false);
    }