/// <summary>
 /// Initializes new bomb.
 /// </summary>
 /// <param name="bombNode"></param>
 public void initializeBomb(BombNode bombNode)
 {
     givenBombCount++;
     bombNode.destroyCounter       = Random.Range(minBombDestroyCounter, maxBombDestroyCounter);
     bombNode.initializedMoveValue = GameManager.instance.moveSys.moveCount;
     bombNode.writeCount();
     currentBombs.Add(bombNode);
 }
Beispiel #2
0
        private void SetupGameMap()
        {
            Dictionary <int, List <int> > xyCords = new Dictionary <int, List <int> >();

            for (int i = 0; i < _bombs; i++)
            {
                AddCord(xyCords);
            }

            for (int i = 0; i < xDimension; i++)
            {
                for (int j = 0; j < yDimension; j++)
                {
                    if (gameMap[i, j] == null)
                    {
                        gameMap[i, j] = new ZeroNode(i, j);
                    }
                }
            }

            void AddCord(Dictionary <int, List <int> > xyCord)
            {
                int x = rand.Next(0, xDimension);
                int y = rand.Next(0, yDimension);

                if (xyCord.ContainsKey(x))
                {
                    if (xyCord[x].Contains(y))
                    {
                        AddCord(xyCord);
                    }
                    else
                    {
                        xyCord[x].Add(y);
                        gameMap[x, y] = new BombNode(x, y);
                    }
                }
                else
                {
                    xyCord.Add(x, new List <int>()
                    {
                        y
                    });
                    gameMap[x, y] = new BombNode(x, y);
                }
            }
        }