void PickupWeapon(PlayerShip pShip, eEnemyGunType gunType) { BaseGun wpn = pShip.GetGun(gunType); if (wpn != null) { if (wpn.CanUpgradeTier) { wpn.UpgradeTier(); pShip.UpdateAquiredGuns(); // This is needed to set the background box from green to purple. } else { pShip.Heal(DOUBLE_PICKUP_HEAL_AMOUNT); } } else { pShip.AddGun(gunType); } }
public void AddGun(eEnemyGunType gunType) { switch (gunType) { case eEnemyGunType.AutoAim: AutoAim aa = Level.Instance.AutoAimPool.New(); aa.Initialize(new Vector2(Animation.Width / 2 - 8, Animation.Height / 2 - 8), Owner); Guns.Add(aa); break; case eEnemyGunType.Boom1Enemy: Boom1 b = Level.Instance.BoomPool.New(); b.Initialize(new Vector2(Animation.Width / 2 - 9, 0), Owner); Guns.Add(b); break; case eEnemyGunType.MG1: throw new Exception("MG Can not be added"); case eEnemyGunType.Missile: Missile m = Level.Instance.MissilePool.New(); m.Initialize(new Vector2(Animation.Width / 2 - 9, Animation.Height / 2 - 11), Owner); Guns.Add(m); break; case eEnemyGunType.DualMissile45: DualMissile45 dm = Level.Instance.DualMissile45Pool.New(); dm.Initialize(new Vector2(Animation.Width / 2 - 11, 5), Owner); Guns.Add(dm); break; default: throw new CaseStatementMissingException(); } UpdateAquiredGuns(); }
public BaseGun GetGun(eEnemyGunType gunType) { return(Guns.FirstOrDefault(g => g.GunType == gunType)); }