Пример #1
0
        public void FillGridByRandom(out ElimlnateGrid result, Func <ElimlnateGrid, bool> randomAginFilters = default)
        {
            BoardGrids boardGrids = mElimiGamePlay.BoardGrids;
            int        index      = Utils.UnityRangeRandom(0, boardGrids.GridsSize);

            result = boardGrids.GetGridByIndex(index);

            bool flag = randomAginFilters != default ? randomAginFilters.Invoke(result) : true;

            if ((result == default) || result.IsDestroyed || flag)
            {
                FillGridByRandom(out result, randomAginFilters);
            }
Пример #2
0
        public override void Start(ref List <ElimlnateGrid> grids, string triggerGridEffect = null)
        {
            if (GamePlayCore == default)
            {
                GamePlayCore = ElimlnateCore.Instance;
            }
            else
            {
            }

            KeyValueList <int, List <int> > gridsEmpty = new KeyValueList <int, List <int> >();

            BoardGrids boardGrids = GamePlayCore.BoardGrids;
            int        max        = boardGrids.GridsSize;

            for (int i = 0; i < max; i++)
            {
                List <int>    emptysInCol;
                ElimlnateGrid grid = boardGrids.GetGridByIndex(i);
                if (grid == default)
                {
                    int col = i % boardGrids.RowSize;
                    if (gridsEmpty[col] == default)
                    {
                        emptysInCol     = new List <int>();
                        gridsEmpty[col] = emptysInCol;
                    }
                    else
                    {
                        emptysInCol = gridsEmpty[col];
                    }
                    emptysInCol.Add(i);
                }
                else
                {
                }
            }

            base.Start(ref grids, triggerGridEffect);
        }