public Missile(ContentManager Content) { this.texture = Content.Load<Texture2D>("Sprites/explode"); this.hidden =new Vector2(position.X, -1000) ; state = MissileUpgradeState.HalfSize; // this.onscreen = position; }
public void UpgradeGun(System.Type weaponType) { bool gunChanged = false; bool missileChanged = false; if (weaponType == typeof(PelletGun)) { if (_currentGunUpgrade != GunUpgradeState.SinglePellet && _currentGunUpgrade != GunUpgradeState.DoublePellet && _currentGunUpgrade != GunUpgradeState.TriplePellet) { gunChanged = true; _currentGunUpgrade = GunUpgradeState.SinglePellet; } else if (_currentGunUpgrade == GunUpgradeState.SinglePellet) { gunChanged = true; _currentGunUpgrade = GunUpgradeState.DoublePellet; } else if (_currentGunUpgrade == GunUpgradeState.DoublePellet) { gunChanged = true; _currentGunUpgrade = GunUpgradeState.TriplePellet; } } else if (weaponType == typeof(MissileLauncher)) { if (_currentMissileUpgrade != MissileUpgradeState.SingleMissile && _currentMissileUpgrade != MissileUpgradeState.DoubleMissile) { missileChanged = true; _currentMissileUpgrade = MissileUpgradeState.SingleMissile; } else if (_currentMissileUpgrade == MissileUpgradeState.SingleMissile) { missileChanged = true; _currentMissileUpgrade = MissileUpgradeState.DoubleMissile; } } if (gunChanged) { _weapons.RemoveAll(x => x.GetType() == typeof(PelletGun)); switch (_currentGunUpgrade) { case GunUpgradeState.SinglePellet: _weapons.Add(new PelletGun(this.centerPosition, new Vector2(0, -this.Height / 3), new Vector2(0, -350), 100, true)); break; case GunUpgradeState.DoublePellet: _weapons.Add(new PelletGun(this.centerPosition, new Vector2(-this.Width / 3, -this.Height / 3), new Vector2(0, -350), 100, true)); _weapons.Add(new PelletGun(this.centerPosition, new Vector2(this.Width / 3, -this.Height / 3), new Vector2(0, -350), 100, true)); break; case GunUpgradeState.TriplePellet: _weapons.Add(new PelletGun(this.centerPosition, new Vector2(0, -this.Height / 3), new Vector2(0, -350), 100, true)); _weapons.Add(new PelletGun(this.centerPosition, new Vector2(-this.Width / 3, -this.Height / 3), new Vector2(-100, -300), 100, true)); _weapons.Add(new PelletGun(this.centerPosition, new Vector2(this.Width / 3, -this.Height / 3), new Vector2(100, -300), 100, true)); break; } } else if (missileChanged) { _weapons.RemoveAll(x => x.GetType() == typeof(MissileLauncher)); switch (_currentMissileUpgrade) { case MissileUpgradeState.SingleMissile: _weapons.Add(new MissileLauncher(this.centerPosition, new Vector2(0, 0), new Vector2(0, -200), 500, true)); break; case MissileUpgradeState.DoubleMissile: _weapons.Add(new MissileLauncher(this.centerPosition, new Vector2(-this.Width / 3, 0), new Vector2(0, -200), 500, true)); _weapons.Add(new MissileLauncher(this.centerPosition, new Vector2(this.Width / 3, 0), new Vector2(0, -200), 500, true)); break; } } }
public void ResetGuns() { _currentGunUpgrade = GunUpgradeState.None; UpgradeGun(typeof(PelletGun)); _currentMissileUpgrade = MissileUpgradeState.None; _weapons.RemoveAll(x => x.GetType() == typeof(MissileLauncher)); }