void ShowMoveRange() { int cellIndex = map.GetCellIndex(tank.currentMap2DLocation); if (cellIndex < 0) { return; } List <int> cells = tank.GetCellNeighbours(); map.CellBlink(cells, Color.blue, 1f); }
/// <summary> /// Adds a fade out effect around row, col positions in a circle /// </summary> void AnimateCells (int row, int col) { int radius = 6; for (int r = row - radius; r <= row + radius; r++) { if (r < 0 || r >= map.gridRows) continue; for (int c = col - radius; c <= col + radius; c++) { if (c < 0 || c >= map.gridColumns) continue; int distance = (int)Mathf.Sqrt ((row - r) * (row - r) + (col - c) * (col - c)); if (distance < radius) { int cellIndex = r * map.gridColumns + c; switch (mode) { default: map.CellFadeOut (cellIndex, Color.red, distance * 0.25f); break; case ACTION_MODE.Flash: map.CellFlash (cellIndex, Color.red, distance * 0.25f); break; case ACTION_MODE.Blink: map.CellBlink (cellIndex, Color.red, distance * 0.25f); break; } } } } }
public void DemoRoute() { Vector2 cityStartRoute = map.GetCity("Madrid", "Spain").unity2DLocation; Vector2 cityEndRoute = map.GetCity("Rome", "Italy").unity2DLocation; Cell startCell = map.GetCell(cityStartRoute); Cell endCell = map.GetCell(cityEndRoute); List <int> cellIndices = map.FindRoute(startCell, endCell, TERRAIN_CAPABILITY.OnlyGround); // Highlight cells in path map.CellBlink(cellIndices, Color.yellow, 4f); // Closer look map.FlyToLocation(cityStartRoute, 0.5f, 0.2f); }