Time for action – the GameManager class
Add a new class called GameManager to the Robot Rampage project.
Add the following
using
directive to the top of the GameManager class:using Microsoft.Xna.Framework;
Modify the declaration of the class to make it a static class:
static class GameManager
Add declarations to the GameManager class:
#region Declarations public static int Score = 0; public static int CurrentWave = 0; public static int BaseTerminalCount = 8; public static int MaxTerminalCount = 15; public static int CurrentTerminalCount = 8; public static Vector2 PlayerStartLoc = new Vector2(32, 32); #endregion
Add public methods to the GameManager class:
#region Public Methods public static void StartNewWave() { CurrentWave++; if (CurrentTerminalCount < MaxTerminalCount) { CurrentTerminalCount++; } Player.BaseSprite.WorldLocation = PlayerStartLoc; Camera.Position = Vector2.Zero; WeaponManager.CurrentWeaponType = WeaponManager.WeaponType.Normal;...