Пример #1
0
    public static void ChageType(Grid grid, GridType gridType)
    {
        switch (gridType)
        {
        case GridType.Wall:
            grid.currentType = GridType.Ground;
            squareGrid.RemoveWall(grid);
            grid.GetComponent <MeshRenderer>().material.color = Color.white;
            break;

        case GridType.Forest:
            grid.currentType = GridType.Wall;
            squareGrid.RemoveForest(grid);
            squareGrid.AddWall(grid);
            grid.GetComponent <MeshRenderer>().material.color = Color.yellow;
            break;

        case GridType.Ground:
            grid.currentType = GridType.Forest;
            squareGrid.AddForest(grid);
            grid.GetComponent <MeshRenderer>().material.color = Color.green;
            break;

        default:
            break;
        }
    }