예제 #1
0
        void TileMouseOver(int tileIndex)
        {
            // Get color of current cell
            Color32 cellColor = hexa.GetTileColor(tileIndex, true);

            // If color is same, don't do anything
            if (cellColor.r == currentColor.r && cellColor.g == currentColor.g && cellColor.b == currentColor.b)
            {
                return;
            }

            // Clears temporary colors
            hexa.ClearTiles(true, false, false);

            // Reset extrusion
            hexa.ClearTilesExtrusion();

            // Select cell
            currentColor = cellColor;

            // If current cell is "sea", ignore and return
            if (currentColor.r == seaColor.r && currentColor.g == seaColor.g && currentColor.b == seaColor.b)
            {
                cycleColorsEnabled = false;
                return;
            }

            // Select tiles with same color
            currentTerritoryTiles.Clear();
            for (int k = 0; k < hexa.tiles.Length; k++)
            {
                if (hexa.GetTileColor(k, true) == currentColor)
                {
                    currentTerritoryTiles.Add(k);
                }
            }

            // Extrude tiles
            hexa.SetTileExtrudeAmount(currentTerritoryTiles, 0.5f);

            // Enable territory highlight color cycle
            cycleColorsEnabled = true;
            blinkBit           = false;
        }