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); } } }
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); }
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 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; }
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; }