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); }
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); } } }
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); } } }
public static Tile CoordToTile(this Vector2 vec) { return(Map.tileData[vec.IntX()][vec.IntY()]); }
public static Tile WorldToTile(this Vector3 pos, float tileSize = 1) { Vector2 p = pos.WorldToTileCoord(tileSize); return(Map.tileData[p.IntX()][p.IntY()]); }
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); } }
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); } }
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; }