Ejemplo n.º 1
0
    private bool neighborsTile(Vector2 tile, Vector2 neighbor)
    {
        if (tile.IntX() == neighbor.IntX())
        {
            if (Math.Abs(tile.IntY() - neighbor.IntY()) == 1)
            {
                return(true);
            }
        }
        else if (tile.IntY() == neighbor.IntY())
        {
            if (Math.Abs(tile.IntX() - neighbor.IntX()) == 1)
            {
                return(true);
            }
        }

        return(false);
    }
Ejemplo n.º 2
0
    private void applyCurrentEffect(Vector2 position)
    {
        LevelGraphTile tile = _grid[position.IntX() + _halfSize, position.IntY() + _halfSize];

        tile.GameObject.transform.Find("Outline").gameObject.GetComponent <LevelSelectColorizer>().UpdateColor(this.PlayerColor);

        if (tile.State == TileState.Available)
        {
            foreach (LevelGraphPath path in neighborPaths(tile))
            {
                path.GameObject.GetComponent <LevelSelectColorizer>().UpdateColor(this.PlayerColor);
            }
        }
    }
Ejemplo n.º 3
0
    private void removeCurrentEffect(Vector2 position)
    {
        LevelGraphTile tile = _grid[position.IntX() + _halfSize, position.IntY() + _halfSize];

        colorizeTile(tile);

        if (tile.State == TileState.Available)
        {
            foreach (LevelGraphPath path in neighborPaths(tile))
            {
                colorizePath(path);
            }
        }
    }
Ejemplo n.º 4
0
    private LevelGraphPath createPath(Vector2 position, GameObject go, TileState state)
    {
        LevelGraphPath path = new LevelGraphPath();

        path.Position   = position;
        path.GameObject = go;
        path.State      = state;

        colorizePath(path);

        if (Math.Abs(position.IntX()) % 2 == 1)
        {
            go.transform.localRotation = Quaternion.AngleAxis(90.0f, new Vector3(0, 0, 1));
        }

        return(path);
    }
Ejemplo n.º 5
0
 public static Tile CoordToTile(this Vector2 vec)
 {
     return(Map.tileData[vec.IntX()][vec.IntY()]);
 }
Ejemplo n.º 6
0
    public static Tile WorldToTile(this Vector3 pos, float tileSize = 1)
    {
        Vector2 p = pos.WorldToTileCoord(tileSize);

        return(Map.tileData[p.IntX()][p.IntY()]);
    }
Ejemplo n.º 7
0
    private void applyCurrentEffect(Vector2 position)
    {
        LevelGraphTile tile = _grid[position.IntX() + _halfSize, position.IntY() + _halfSize];
        tile.GameObject.transform.Find("Outline").gameObject.GetComponent<LevelSelectColorizer>().UpdateColor(this.PlayerColor);

        if (tile.State == TileState.Available)
        {
            foreach (LevelGraphPath path in neighborPaths(tile))
                path.GameObject.GetComponent<LevelSelectColorizer>().UpdateColor(this.PlayerColor);
        }
    }
Ejemplo n.º 8
0
    private void removeCurrentEffect(Vector2 position)
    {
        LevelGraphTile tile = _grid[position.IntX() + _halfSize, position.IntY() + _halfSize];
        colorizeTile(tile);

        if (tile.State == TileState.Available)
        {
            foreach (LevelGraphPath path in neighborPaths(tile))
                colorizePath(path);
        }
    }
Ejemplo n.º 9
0
    private LevelGraphPath createPath(Vector2 position, GameObject go, TileState state)
    {
        LevelGraphPath path = new LevelGraphPath();
        path.Position = position;
        path.GameObject = go;
        path.State = state;

        colorizePath(path);

        if (Math.Abs(position.IntX()) % 2 == 1)
            go.transform.localRotation = Quaternion.AngleAxis(90.0f, new Vector3(0, 0, 1));

        return path;
    }
Ejemplo n.º 10
0
    private bool neighborsTile(Vector2 tile, Vector2 neighbor)
    {
        if (tile.IntX() == neighbor.IntX())
        {
            if (Math.Abs(tile.IntY() - neighbor.IntY()) == 1)
                return true;
        }
        else if (tile.IntY() == neighbor.IntY())
        {
            if (Math.Abs(tile.IntX() - neighbor.IntX()) == 1)
                return true;
        }

        return false;
    }