コード例 #1
0
        private void RemoveCannon(int i)
        {
            Cannon cannon = ClosestCannon(Enemies[i]);

            Explosions.AddLast(new Explosion(cannon.Left - 35, cannon.Top));
            Cannons.Remove(cannon);
            Enemies.RemoveAt(i);
            SoundCollection.PlayCrushSound();
            ShakeForm();
        }
コード例 #2
0
 private void chkPlayMusic_CheckedChanged(object sender, EventArgs e)
 {
     if (chkPlayMusic.Checked)
     {
         SoundCollection.ChangeMusicVolume(0);
         sldMusic.Enabled = false;
     }
     else
     {
         SoundCollection.ChangeMusicVolume((int)sldMusic.Value);
         sldMusic.Enabled = true;
     }
 }
コード例 #3
0
 private void chkSound_CheckedChanged(object sender, EventArgs e)
 {
     if (chkSound.Checked)
     {
         SoundCollection.ChangeSoundVolume(0);
         sldSound.Enabled = false;
     }
     else
     {
         SoundCollection.ChangeSoundVolume((int)sldSound.Value);
         sldSound.Enabled = true;
     }
 }
コード例 #4
0
ファイル: FormMenu.cs プロジェクト: btrajkovski/Char-Invaders
 public FormMenu()
 {
     InitializeComponent();
     SoundCollection.Initialize();
     this.DoubleBuffered = true;
     frmScore            = new FormHighScore(this);
     frmSettings         = new FormSettings(this);
     frmHowTo            = new FormHowTo(this);
     frmCredits          = new FormCredits(this);
     Tema = new Theme();
     Tema.addTheme(this);
     setTheme();
 }
コード例 #5
0
        public bool ShootEnemy(string enemy)
        {
            Enemy res = null;

            foreach (Enemy enemyIterator in Enemies)
            {
                if (enemyIterator.Letter.ToString() == enemy)
                {
                    res = enemyIterator;
                    break;
                }
            }
            if (res != null)
            {
                if (res.Name == "SlowMotion")
                {
                    TheForm.TimerCreateLetter.Interval = gameLevel.ENEMY_APPEAR_SLOW_MOTION;
                    isSlowMotionActive = true;
                    TimerSlowMotion.Start();
                    SoundCollection.PlaySlowMotionStart();
                }
                if (res.Name == "Bonus")
                {
                    TheForm.CurrentScore += gameLevel.POINTS_HIT * 5;
                    TheForm.UpdateScore();
                }
                if (res.Name == "Destroyer")
                {
                    TheForm.CurrentScore += gameLevel.POINTS_HIT * Enemies.Count;
                    TheForm.UpdateScore();
                    foreach (Enemy e in Enemies)
                    {
                        if (e.Name != "Destroyer")
                        {
                            Explosions.AddLast(new Explosion(e.Left - 50, e.Top - 25));
                        }
                    }
                    Enemies = new List <Enemy>();
                }

                Enemies.Remove(res);
                DrawStrike(res);
                SoundCollection.PlayLaserSound();
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
        void TimerSlowMotion_Tick(object sender, EventArgs e)
        {
            if (!TheForm.IsPaused)
            {
                if (SecoundsLeft > 1)
                {
                    SecoundsLeft--;
                    if (SecoundsLeft == 1)
                    {
                        SoundCollection.PlaySlowMotionFinish();
                    }
                }
                else
                {
                    TimerSlowMotion.Dispose();
                    TheForm.TimerCreateLetter.Interval = gameLevel.ENEMY_APPEAR;
                    SecoundsLeft = 5;

                    isSlowMotionActive = false;
                }
            }
        }
コード例 #7
0
 private void sldMusic_Scroll(object sender, EventArgs e)
 {
     SoundCollection.ChangeMusicVolume((int)sldMusic.Value);
 }
コード例 #8
0
 private void sldSound_Scroll(object sender, EventArgs e)
 {
     SoundCollection.ChangeSoundVolume((int)sldSound.Value);
 }
コード例 #9
0
ファイル: FormMenu.cs プロジェクト: btrajkovski/Char-Invaders
 private void FormMenu_Load(object sender, EventArgs e)
 {
     SoundCollection.PlayThemeSong();
 }