Esempio n. 1
0
    /// <summary>
    ///
    /// Switches the map filter overlay to display information about the map using a given filter type. Current Filters are:
    /// - No overlay
    /// = Terrain
    /// = Deployment
    /// = Objective
    ///
    /// </summary>
    public void SwitchMapFilter(MapFilters filterType)
    {
        //Sets the active Filter type
        activeMapFilter = filterType;

        //Loop through each cell in the map
        for (int y = 0; y < numY; y++)
        {
            for (int x = 0; x < numX; x++)
            {
                Cell cell = GetCell(x, y);

                switch (filterType)
                {
                case MapFilters.Terrain:
                    //Terrain Colour Overlay. All tiles for the terrain overlay should have a colour filling
                    var terrainColour = GameManager.instance.colourManager.GetTerrainColour(cell.terrainType);
                    cell.SetBackgroundColour(terrainColour, true);
                    break;

                case MapFilters.Deployment:
                    //Deployment Overlay for the map. Currently only displays fixed deployment map. Temporary deployment tiles are not included
                    //If the cell cannot be deployed into, cell will be blank
                    if (cell.playerDeploymentId.HasValue)
                    {
                        var deploymentColour = GameManager.instance.colourManager.GetPlayerColour(cell.playerDeploymentId.Value);
                        cell.SetBackgroundColour(deploymentColour, true);
                    }
                    else
                    {
                        cell.HideBackground();
                    }
                    break;

                case MapFilters.Objective:
                    //Objective overaly for the map
                    // If the cell has no objective in it, cell will be blank
                    if (cell.objective != null)
                    {
                        cell.SetBackgroundColour(cell.objective.Color, true);
                    }
                    else
                    {
                        cell.HideBackground();
                    }
                    break;

                //Other overlays will have no filled in cells and just show the colour map
                default:
                case MapFilters.Colour:
                    cell.HideBackground();
                    break;
                }
            }
        }
    }
Esempio n. 2
0
 private void Awake()
 {
     baseCellScale   = cellObject.transform.localScale;
     activeMapFilter = MapFilters.Colour;
 }