Пример #1
0
        static private void ChceckTimerObjects()
        {
            for (int i = ObjectToDraw.Count - 1; i >= 0; i--)
            {
                if (ObjectToDraw[i] is Fire fire1)
                {
                    fire1.ShorterTimeToEndFire();
                    if (fire1.GetTimeToEndFire() <= 0)
                    {
                        ObjectToDraw.Remove(ObjectToDraw[i]);
                    }
                }
                else if (ObjectToDraw[i] is Powerups powerups1)
                {
                    if (powerups1.GetIndestructible() <= 0)
                    {
                        powerups1.SetNextTexture(PowerupsTextures[powerups1.GetTypePowerups() - 1].Count);
                    }
                    else
                    {
                        powerups1.IndestructibleDecrement();
                    }
                }
                else if (ObjectToDraw[i] is Bomb bomb1)
                {
                    bomb1.ShortenTheTimer();
                    if (bomb1.GetTimer() % ((int)(bomb1.GetMaxTime() / (BombTextures.Count)) + 1) == 0 && bomb1.GetMaxTime() != bomb1.GetTimer())
                    {
                        bomb1.SetNextTexture();
                    }
                    if (bomb1.CheckDestroyTimer())
                    {
                        DestroyBomb(i, bomb1);
                        if (ProgramParameters.Get_MusicEnable())
                        {
                            BombDestroy.Play(0.5f, 0f, 0f);
                        }
                    }
                }
            }

            foreach (Character Character1 in Player)
            {
                Character1.ShortenTheDelay();//Player shorten time to put bomb
            }
        }