/// <summary>
    /// Updates only the tiles directly affected by an action, send List of needed elements
    /// (Only for when revealing new tiles)
    /// </summary>
    /// <param name="toupdate">Information about newly revealed tiles</param>
    /// <param name="mat">The newly revealed tiles of the minesweeper table</param>
    public override void GetRelevantBoard(KeyValuePair <Vector2Int, MinesweeperElementInfo>[] toupdate, MinesweeperActionType mat)
    {
        if (mat == MinesweeperActionType.Uncover)
        {
            for (int i = 0; i < toupdate.Length; i++)
            {
                //note that every item in toupdate are revealed
                Vector2Int             currentnewrevealed = toupdate[i].Key;
                MinesweeperElementInfo currentmsei        = toupdate[i].Value;

                //there is always a possibility that the newly revealed tiles are in Open or Safe (when multiple tiles revealed)
                RemoveForSafety(currentnewrevealed);
                //add non-empties to 'Closed'
                if (currentmsei.value != 0)
                {
                    Closed.Add(currentnewrevealed, currentmsei.value);

                    //iterating  through currently revealed tile, finding new tiles while trying to eliminate currentnewrevealed
                    CheckingNewRevealed(currentnewrevealed);
                    //remove from closed if after iteration value become 0 or less
                    if (Closed[currentnewrevealed] <= 0)
                    {
                        WhenRemovingClosedNeighborCheck(currentnewrevealed);
                    }
                }
                else
                {
                    InvalidTiles[currentnewrevealed.x, currentnewrevealed.y] = true;
                }
            }
        }
        else if (mat == MinesweeperActionType.Flag)
        {
            for (int i = 0; i < toupdate.Length; i++)
            {
                Vector2Int currentmine = toupdate[i].Key;
                OnAddingFlaged(currentmine);
            }
        }
    }
Exemple #2
0
 public abstract void GetRelevantBoard(KeyValuePair <Vector2Int, MinesweeperElementInfo>[] newtiles, MinesweeperActionType mat);