Beispiel #1
0
 private void InitBoardIndexes()
 {
     for (int i = 0; i < width; ++i)
     {
         for (int j = 0; j < height; ++j)
         {
             indexMap[i].RemoveAt(0);
             indexMap[i].Add(TileIndexRandomizator.GetRandomTileValue());
         }
     }
 }
Beispiel #2
0
    private IEnumerator DeleteCoroutine(List <BoardCoordinate> deleteCoordinate)
    {
        newIndexMap.Clear();

        newIndexMap = new List <List <int> >();

        for (int i = 0; i < width; ++i)
        {
            newIndexMap.Add(new List <int>());
        }

        if (deleteCoordinate.Count != 0)
        {
            while (deleteCoordinate.Count != 0)
            {
                indexMap[deleteCoordinate[0].column][deleteCoordinate[0].row] = -1;
                deleteCoordinate.RemoveAt(0);
            }

            for (int i = 0; i < width; ++i)
            {
                int iterator = 0;

                for (int j = 0; j < height - iterator; ++j)
                {
                    if (indexMap[i][j] != -1)
                    {
                        continue;
                    }

                    indexMap[i].RemoveAt(j);

                    yield return(Ninja.JumpToUnity);

                    var index = TileIndexRandomizator.GetRandomTileValue();
                    yield return(Ninja.JumpBack);

                    indexMap[i].Add(index);
                    newIndexMap[i].Add(index);

                    iterator++;
                    j--;
                }
            }
        }
    }