/// <summary> /// First if: If spawner cooldown is at zero, spawn a new zombie and restart the timer. /// Second if: If the round timer is at zero, go to the next round and restart the timer plus the amounts of rounds. /// /// dead_zombie() checks if any zombie is dead and then deletes them if they are. /// /// For loop updates all zombies. /// /// Lastly updates both timers. /// </summary> public static void Update() { // Spawns zombies if (!spawn_timer.Active) { add_zombie(); spawn_timer.Start(Random_float.Get(0.1f, 2f)); } // Changes rounds if (!round_timer.Active) { In_Game.Rounds++; round_timer.Start(40 + In_Game.Rounds); } // Checks if any zombie is dead. dead_zombie(); // Updates all zombies for (int i = Zombies.Count - 1; i >= 0; i--) { Zombies[i].Update(); } spawn_timer.Update(); round_timer.Update(); }
/// <summary> /// First checks if it is the shotgun or not. /// /// If it is the shotgun it will allow the player to click once and then fire ten bullets, /// /// If it's not the shotgun it checks if spray is on or not. /// If spray is on it will fire bullets as long as the timer doesn't stop you otherwise you will have to click each time. /// </summary> public static void Fire() { Vector2 wep_pos = new Vector2(Objects.weapon.body.X, Objects.weapon.body.Y); if (shotgun) { if (mState.LeftButton == ButtonState.Pressed && old_mState.LeftButton != ButtonState.Pressed && !shotgun_cool.Active) { for (int i = 10; i > 0; i--) { Objects.bullets.Shoot(Objects.weapon.Dir + 3.15f + Random_float.Get(-spread, spread), wep_pos); } // Shotgun Cooldown shotgun_cool.Start(0.3f); } } else { if (spray) { if (mState.LeftButton == ButtonState.Pressed && !ak_cool.Active) { Objects.bullets.Shoot(Objects.weapon.Dir + 3.15f + Random_float.Get(-spread, spread), wep_pos); ak_cool.Start(0.05f); } } else { if (mState.LeftButton == ButtonState.Pressed && old_mState.LeftButton != ButtonState.Pressed && !pistol_cool.Active) { Objects.bullets.Shoot(Objects.weapon.Dir + 3.15f + Random_float.Get(-spread, spread), wep_pos); pistol_cool.Start(0.08f); } } } }