示例#1
0
        private void SetCoinNegativePoints(int cellIndex, int distance, CellManager cellManager)
        {
            pathFinder.FindCellsInDistance(cellIndex, distance);

            for (int i = 0; i < cellManager.cells.Length; i++)
            {
                if ((cellManager.cells[i] & CellManager.maskGPF) != 0)
                {
                    cellManager.CoinNegativePoint(i);
                }
            }

            cellManager.ClearCellsAfterPF();
        }
示例#2
0
        private void GenerateCoinPosition(int distance, CellManager cellManager)
        {
            if (cellManager.CountCoinPositions() == 0)
            {
                Debug.LogError("Don't have free coin positions");
                return;
            }

            var cellIndex = Random.Range(0, cellManager.cells.Length);

            while ((cellManager.cells[cellIndex] & CellManager.maskCoinNegativePoint) != 0)
            {
                cellIndex = Random.Range(0, cellManager.cells.Length);
            }

            cellManager.SetCoinInCell(cellIndex);
            cellManager.CoinNegativePoint(cellIndex);
            SetCoinNegativePoints(cellIndex, distance, cellManager);
        }