Time for action – new weapons
Add the following declarations to the WeaponManager class:
static private float rocketMinTimer = 0.5f; public enum WeaponType { Normal, Triple, Rocket }; static public WeaponType CurrentWeaponType = WeaponType.Triple; static public float WeaponTimeRemaining = 30.0f; static private float weaponTimeDefault = 30.0f; static private float tripleWeaponSplitAngle = 15;
Replace the current
WeaponFireDelay
property with the following:static public float WeaponFireDelay { get { if (CurrentWeaponType==WeaponType.Rocket) { return rocketMinTimer; } else { return shotMinTimer; } } }
Replace the current
FireWeapon()
method with the following:public static void FireWeapon(Vector2 location, Vector2 velocity) { switch (CurrentWeaponType) { case WeaponType.Normal: AddShot(location, velocity, 0); break; case WeaponType.Triple: AddShot...