Пример #1
0
        private bool HandleCollision(PowerupCell powerup)
        {
            if (CheckBounds2CellCollision(powerup))
            {
                powerup.RemoveFromField();
                return(true);
            }

            return(false);
        }
Пример #2
0
        private bool HandleCollision(PowerupCell powerup)
        {
            if (CheckBounds2CellCollision(powerup))
            {
                powerup.RemoveFromField();
                return true;
            }

            return false;
        }
Пример #3
0
        public void DropPowerups(Player player)
        {
            FieldCellSlot[] slots = new FieldCellSlot[GetWidth() * GetHeight()];
            int slotsCount = GetEmptySlots(slots);
            if (slotsCount == 0)
            {
                return;
            }

            ShuffleSlots(slots, slotsCount);

            PowerupList powerups = player.powerups;
            int slotIndex = 0;
            for (int powerupIndex = 0; powerupIndex < Powerups.Count && slotIndex < slots.Length; ++powerupIndex)
            {
                int count = powerups.GetCount(powerupIndex);
                for (int i = 0; i < count && slotIndex < slots.Length; ++i)
                {
                    FieldCellSlot slot = slots[slotIndex++];
                    PowerupCell cell = new PowerupCell(powerupIndex, slot.cx, slot.cy);
                    AddCell(cell);
                }
            }
        }
        private bool HandleCollision(PowerupCell cell)
        {
            int powerup = cell.powerup;
            TryAddPowerup(powerup);

            cell.RemoveFromField();
            return true;
        }
        private void DrawPowerup(Context context, PowerupCell powerupCell)
        {
            int powerup = powerupCell.powerup;
            if (powerup != Powerups.None)
            {
                if (powerup == Powerups.Random)
                {
                    powerup = ((int)(powerupCell.elasped / 0.05f)) % powerupImages.Length;
                }

                TextureImage image = powerupImages[powerup];
                DrawCellImage(context, powerupCell, image);
            }
        }