示例#1
0
 /// <summary>
 /// Resets all grid cells materials to it's initial visual state
 /// </summary>
 public void ResetGridCellsAppearance()
 {
     for (int row = 0; row < rows; row++)
     {
         for (int column = 0; column < columns; column++)
         {
             GridMeshBuilder.CellInfo cell = grid.GetCell(column, row);
             cell.material.color = cell.defaultMaterial.color;
         }
     }
 }
示例#2
0
        /// <summary>
        /// Display target zone on the arena prespective grid
        /// </summary>
        public void ShowTargetZone(Vector2Int actorPosition, int[,] targetZone, Color playerColor)
        {
            List <GridMeshBuilder.CellInfo> modifiedCells = new List <GridMeshBuilder.CellInfo>();

            Vector2Int actorTargetZonePosition    = GetActorTargetZoneLocalPosition(targetZone);
            Vector2Int searchRange                = new Vector2Int(targetZone.GetLength(0), targetZone.GetLength(1));
            Vector2Int anchoredGridSearchPosition = actorPosition - actorTargetZonePosition; // top left anchor

            //Vector2Int worldGridSearchIterator = startSearchCoord;
            Vector2Int gridBounds = new Vector2Int(actorGrid.GetLength(0), actorGrid.GetLength(1));

            for (int x = 0, x2 = anchoredGridSearchPosition.x; x < searchRange.x; x++, x2++)     // rows
            {
                for (int y = 0, y2 = anchoredGridSearchPosition.y; y < searchRange.y; y++, y2++) // columns

                {
                    if (x2 >= 0 && x2 < gridBounds.x && y2 >= 0 && y2 < gridBounds.y)
                    {
                        GridMeshBuilder.CellInfo cell = grid.GetCell(y2, x2);
                        int targetZoneValue           = targetZone[x, y];

                        if (targetZoneValue == 2)
                        {
                            //Debug.Log(x2 + " " + y2 + " = " + tzValue);

                            Color color = Color.red;

                            color.a             = cell.defaultMaterial.color.a;
                            cell.material.color = color;
                        }
                        else if (targetZoneValue == 1)
                        {
                            Color color = playerColor;
                            color.a             = cell.defaultMaterial.color.a;
                            cell.material.color = color;
                        }
                    }
                }
            }
        }
示例#3
0
 /// <summary>
 /// Unhighlights the cell at given column and row
 /// </summary>
 /// <param name="row"></param>
 /// <param name="column"></param>
 public void UnhighlightCell(int row, int column)
 {
     GridMeshBuilder.CellInfo cell = grid.GetCell(column, row);
     cell.material.color = cell.defaultMaterial.color;
 }
示例#4
0
 /// <summary>
 /// Highlights the cell at given column and row with passed color
 /// </summary>
 public void HighlightCell(int row, int column, Color color)
 {
     GridMeshBuilder.CellInfo cell = grid.GetCell(column, row);
     cell.material.color = color;
 }