Esempio n. 1
0
        private void UpdateFullLines(int[] heightsMas)
        {
            foreach (var height in heightsMas)
            {
                if (IsFullLine(height))
                {
                    var falledObjects = GetGameObjectsByPriority(FalledObject.GetPriority());

                    foreach (var gameObj in falledObjects)
                    {
                        if (gameObj.Center.Y / CellSize > height)
                        {
                            (gameObj as FalledObject).IncreaseFallingTime();
                        }
                    }

                    for (int i = falledObjects.Count - 1; i >= 0; i--)
                    {
                        if (falledObjects[i].Center.Y / CellSize == height)
                        {
                            RemoveGameObject(falledObjects[i]);
                        }
                    }

                    Score += GameScoreIncrement;
                }
            }
        }
Esempio n. 2
0
        private bool IsFullLine(int height)
        {
            bool[] used = new bool[GridWidth];
            foreach (var gameObj in GetGameObjectsByPriority(FalledObject.GetPriority()))
            {
                if (gameObj.Center.Y / CellSize == height)
                {
                    used[gameObj.Center.X / CellSize] = true;
                }
            }

            return(!used.Any(e => e == false));
        }