public void Update(GameTime gameTime) { EnemyShotManager.Update(gameTime); for (int x = Enemies.Count - 1; x >= 0; x--) { Enemies[x].Update(gameTime); if (Enemies[x].IsActive() == false) { Enemies.RemoveAt(x); } else { if ((float)rand.Next(0, 1000) / 10 <= shipShotChance) { Vector2 fireLoc = Enemies[x].EnemySprite.Location; fireLoc += Enemies[x].gunOffset; Vector2 shotDirection = playerManager.playerSprite.Center - fireLoc; shotDirection.Normalize(); EnemyShotManager.FireShot(fireLoc, shotDirection, false); } } } if (Active) { updateWaveSpawns(gameTime); } }
private void FireShot() { if (shotTimer >= minShotTimer) { PlayerShotManager.FireShot(playerSprite.Location + gunOffset, new Vector2(0, -1), true); shotTimer = 0.0f; } }
private void FireShot(Vector2 velocity) { if (shotTimer >= minShotTimer) { PlayerShotManager.FireShot( playerSprite.Location + gunOffset, velocity, true); shotTimer = 0.0f; } }
private void FireShot() { if (shotTimer >= minShotTimer) { Vector2 vel = TrigHelper.AngleToVector(playerSprite.Rotation); PlayerShotManager.FireShot( playerSprite.Center + vel * 25f, vel, true); shotTimer = 0.0f; } }
private void FireShot() { if (shotTimer >= minShotTimer) { if (CurrentLevel == 1) { PlayerShotManager.FireShot( playerSprite.Location + gunOffset, new Vector2(0, -1), true); } else if (CurrentLevel == 2) { Vector2 direction = new Vector2(5, -100); direction.Normalize(); PlayerShotManager.FireShot( playerSprite.Location + gunOffset, direction, true); direction = new Vector2(-5, -100); direction.Normalize(); PlayerShotManager.FireShot( playerSprite.Location + gunOffset, direction, true); } else { PlayerShotManager.FireShot( playerSprite.Location + gunOffset, new Vector2(0, -1), true); Random rand = new Random(System.Environment.TickCount); for (int i = 1; i < CurrentLevel - 1; i++) { Vector2 direction = new Vector2(-8 * i, -100 + rand.Next(-50, 50)); direction.Normalize(); PlayerShotManager.FireShot( playerSprite.Location + gunOffset, direction, true); direction = new Vector2(8 * i, -100 + rand.Next(-50, 50)); direction.Normalize(); PlayerShotManager.FireShot( playerSprite.Location + gunOffset, direction, true); } } shotTimer = 0.0f; } }
private void FireShot() { if (shotTimer >= minShotTimer && !isD4) { PlayerShotManager.FireShot( playerSprite.Location + gunOffset, new Vector2(0, -1), true); shotTimer = 0.0f; if (PowerupLevel == 2) { for (int i = -60; i <= 60; i += 30) { Vector2 newShot = new Vector2(i, -100); newShot.Normalize(); PlayerShotManager.FireShot( playerSprite.Location + gunOffset, newShot, true); } } } if (isD4 && shotTimer >= minShotTimer) { shotTimer = 0.0f; for (int i = -60; i <= 60; i += 30) { Vector2 newShotR = new Vector2(20, -20); newShotR.Normalize(); PlayerShotManager.FireShot( playerSprite.Location + gunOffset, newShotR, true); Vector2 newShotL = new Vector2(-20, -20); newShotL.Normalize(); PlayerShotManager.FireShot( playerSprite.Location + gunOffset, newShotL, true); } if (PowerupLevel == 2) { for (int i = -60; i <= 60; i += 30) { Vector2 newShot = new Vector2(i, -100); newShot.Normalize(); PlayerShotManager.FireShot( playerSprite.Location + gunOffset, newShot, true); } } } }