Esempio n. 1
0
 public void CD(object sender, CoolDownShotArgs arg)
 {
     if (CDVG.MCD >= MainCoolDown)
     {
         CDVG = new CoolDownVaritableGroup(MainCoolDown, CDVG.FCD, CDVG.SCD, CDVG.TCD);
         if (CDVG.TCD >= CoolDownThirdBullet)
         {
             CDVG = new CoolDownVaritableGroup(CDVG.MCD, CDVG.FCD, CDVG.SCD, CoolDownThirdBullet);
             if (CDVG.SCD >= CoolDownSecondBullet)
             {
                 CDVG = new CoolDownVaritableGroup(CDVG.MCD, CDVG.FCD, CoolDownSecondBullet, CDVG.TCD);
                 if (CDVG.FCD >= CoolDownFirstBullet)
                 {
                     CDVG = new CoolDownVaritableGroup(CDVG.MCD, CoolDownFirstBullet, CDVG.SCD, CDVG.TCD);
                 }
                 else
                 {
                     CDVG = new CoolDownVaritableGroup(CDVG.MCD, CDVG.FCD + arg.FrameTime.ElapsedTime.AsSeconds(), CDVG.SCD, CDVG.TCD);
                 }
             }
             else
             {
                 CDVG = new CoolDownVaritableGroup(CDVG.MCD, CDVG.FCD, CDVG.SCD + arg.FrameTime.ElapsedTime.AsSeconds(), CDVG.TCD);
             }
         }
         else
         {
             CDVG = new CoolDownVaritableGroup(CDVG.MCD, CDVG.FCD, CDVG.SCD, CDVG.TCD + arg.FrameTime.ElapsedTime.AsSeconds());
         }
     }
     else
     {
         CDVG = new CoolDownVaritableGroup(CDVG.MCD + arg.FrameTime.ElapsedTime.AsSeconds(), CDVG.FCD, CDVG.SCD, CDVG.TCD);
     }
 }
Esempio n. 2
0
 public Tower(Vector2f position)
 {
     CDVG   = new CoolDownVaritableGroup(0, 0, 0, 0);
     Sprite = new Sprite(Resurses.TowerTexture, new IntRect(0, 0, 132, 54))
     {
         Origin   = new Vector2f(27, 27),
         Position = position
     };
     ShotSound = new Sound();
     Rnd       = new Random();
 }
Esempio n. 3
0
 public void Shot(object sender, MouseButtonEventArgs arg)
 {
     if (Game.Level > 0 && arg.Button == Mouse.Button.Left)
     {
         if (CDVG.MCD >= MainCoolDown)
         {
             if (CDVG.FCD >= CoolDownFirstBullet)
             {
                 BulletSpawnEvent.Invoke(this, new BulletSpawnArgs(new Bullet(Position, Sprite.Rotation, Resurses.PlayerBullet, WhoIs._player)));
                 CDVG = new CoolDownVaritableGroup(0, 0, CDVG.SCD, CDVG.TCD);
                 ShotSound.SoundBuffer = Resurses.SoundBuffersTankShot[Rnd.Next(0, 3)];
                 ShotSound.Play();
             }
             else if (CDVG.SCD >= CoolDownSecondBullet)
             {
                 BulletSpawnEvent.Invoke(this, new BulletSpawnArgs(new Bullet(Position, Sprite.Rotation, Resurses.PlayerBullet, WhoIs._player)));
                 CDVG = new CoolDownVaritableGroup(0, 0, 0, CDVG.TCD);
                 ShotSound.SoundBuffer = Resurses.SoundBuffersTankShot[Rnd.Next(0, 3)];
                 ShotSound.Play();
             }
             else if (CDVG.TCD >= CoolDownThirdBullet)
             {
                 BulletSpawnEvent.Invoke(this, new BulletSpawnArgs(new Bullet(Position, Sprite.Rotation, Resurses.PlayerBullet, WhoIs._player)));
                 CDVG = new CoolDownVaritableGroup(0, 0, 0, 0);
                 ShotSound.SoundBuffer = Resurses.SoundBuffersTankShot[Rnd.Next(0, 3)];
                 ShotSound.Play();
             }
         }
     }
     //else if (Game.Level > 0 && arg.Button == Mouse.Button.Right)
     //{
     //    BulletSpawnEvent.Invoke(this, new BulletSpawnArgs(new Bullet(Position, Sprite.Rotation, Resurses.PlayerBullet, WhoIs._player)));
     //    ShotSound.SoundBuffer = Resurses.SoundBuffersTankShot[Rnd.Next(0, 3)];
     //    ShotSound.Play();
     //}
     //Это оставили что бы стрелять без перезарядки
 }
Esempio n. 4
0
 public void CDUP()
 {
     CDVG = new CoolDownVaritableGroup(1, 2, 4, 5);
 }