public IEnumerator<float> ClusterBombs(GameObject go) { Bullet thisBullet = (Bullet)go; thisBullet.LerpVelocity(0f, 3f); yield return 3f + (thisBullet.CustomValue1 * .6f); BulletEmitter explosion = new BulletEmitter(this, thisBullet.Center); AudioManager.PlaySoundEffect(GameScene.Shot1Sound, .7f, 0f); AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .7f, 0f); explosion.FireBulletExplosion(6, 160f, Color.Lerp(Color.White, Color.DeepSkyBlue, .4f)); explosion.FireBulletCluster(VectorMathHelper.GetAngleTo(thisBullet.Center, thisScene.player.InnerHitbox.Center), 3, 40f, 160f, 40f, Color.Lerp(Color.White, Color.DeepSkyBlue, .4f), BulletType.Circle); explosion.FireBulletCluster(VectorMathHelper.GetAngleTo(thisBullet.Center, thisScene.player.InnerHitbox.Center), 4, 50f, 140f, 50f, Color.Lerp(Color.White, Color.DeepSkyBlue, .4f), BulletType.CircleSmall); explosion.Destroy(); thisBullet.Destroy(); }
// Main script public IEnumerator<float> MainScriptPhase1(GameObject thisShip) { BulletEmitter mainEmitter = new BulletEmitter(this, this.Center, false); mainEmitter.LockedToParentPosition = true; int bossPhase = 1; LerpPosition(new Vector2(300f, 125f), 2f); yield return 3f; Vulnerable = true; bool alive = true; while (alive) { int cycles = 0; while (bossPhase == 1) { int shots = 0; while (shots < 15) { AudioManager.PlaySoundEffect(GameScene.Shot1Sound, .8f, .4f); mainEmitter.FireBulletSpread(((float)Math.PI / 2), 7, 90f, 140f, Color.Lerp(Color.White, Color.Orange, .45f), BulletType.Circle); shots++; yield return .25f; AudioManager.PlaySoundEffect(GameScene.Shot1Sound, .8f, .2f); mainEmitter.FireBulletSpread(((float)Math.PI / 2), 6, 70f, 140f, Color.Lerp(Color.White, Color.Orange, .45f), BulletType.Circle); shots++; yield return .25f; } shots = 0; LerpPosition(new Vector2(25, 125), 1.5f); yield return 1.5f; while (shots < 20) { AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .3f, -.6f); mainEmitter.FireBulletSpread(((float)Math.PI / 2 * .6f) + (float)Math.Sin(currentGameTime * 3) / 4, 3, 25f, 220f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); shots++; yield return .06f; } shots = 0; LerpPosition(new Vector2(600, 125), 2.5f); yield return 2.5f; while (shots < 20) { AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .3f, -.6f); mainEmitter.FireBulletSpread(((float)Math.PI / 2 * 1.4f) + (float)Math.Sin(currentGameTime * 3) / 4, 3, 25f, 220f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); shots++; yield return .06f; } LerpPosition(new Vector2(300f, 125f), 1.5f); yield return 2.2f; cycles++; if (cycles > 1) bossPhase++; } subEmitter1 = new BulletEmitter(this, this.Center, false); subEmitter1.LockedToParentPosition = true; subEmitter1.LockPositionOffset = new Vector2(-28f, -10f); subEmitter2 = new BulletEmitter(this, this.Center, false); subEmitter2.LockedToParentPosition = true; subEmitter2.LockPositionOffset = new Vector2(28f, -10f); scriptManager.Execute(Subemitter1Script, subEmitter1); scriptManager.Execute(Subemitter2Script, subEmitter2); scriptManager.Execute(SubemitterFirePhase2, subEmitter1); scriptManager.Execute(SubemitterFirePhase2, subEmitter2); yield return 1f; cycles = 0; while (bossPhase == 2) { AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f, 0f); mainEmitter.FireBulletExplosion(15, 100f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); yield return .5f; LerpPosition(new Vector2(50, 400), 3f); yield return 1.5f; AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f, 0f); mainEmitter.FireBulletExplosion(15, 100f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); yield return .5f; LerpPosition(new Vector2(550, 400), 3f); yield return 1.5f; LerpPosition(new Vector2(300f, 250f), 2f); AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f, 0f); mainEmitter.FireBulletExplosion(15, 100f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); yield return .5f; LerpPosition(new Vector2(300f, 125f), 4f); yield return .25f; AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f, 0f); mainEmitter.FireBulletExplosion(15, 150f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); yield return .25f; AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f, 0f); mainEmitter.FireBulletExplosion(13, 150f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); yield return .25f; AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f, 0f); mainEmitter.FireBulletExplosion(11, 150f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); yield return .25f; AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f, 0f); mainEmitter.FireBulletExplosion(15, 150f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); yield return .25f; AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f, 0f); mainEmitter.FireBulletExplosion(13, 150f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); yield return .25f; AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f, 0f); mainEmitter.FireBulletExplosion(11, 150f, Color.Lerp(Color.White, Color.DeepSkyBlue, .45f), BulletType.Circle); yield return .5f; cycles++; if (cycles > 2) { bossPhase = 3; } } cycles = 0; subEmitter1.Destroy(); subEmitter2.Destroy(); LerpPosition(new Vector2(300f, 125f), 3.5f); while (bossPhase == 3) { int shots = 0; while (shots < 25) { shots++; AudioManager.PlaySoundEffect(GameScene.Shot3Sound, .5f, -.6f); mainEmitter.FireBulletSpread(VectorMathHelper.GetAngleTo(this.Hitbox.Center, thisScene.player.InnerHitbox.Center), 5, 80f, 200f, Color.Lerp(Color.White, Color.Orange, .4f), BulletType.Circle); yield return .175f; } int i = 1; AudioManager.PlaySoundEffect(GameScene.Shot8Sound, 1f, 0f); foreach (Bullet b in mainEmitter.FireBulletWave(0f, 4, 200f, 50f, Color.Lerp(Color.White, Color.Orange, .3f))) { b.CustomValue1 = i++; scriptManager.Execute(ClusterBombs, b); } i = 1; foreach (Bullet b in mainEmitter.FireBulletWave((float)Math.PI, 4, 200f, 50f, Color.Lerp(Color.White, Color.Orange, .3f))) { b.CustomValue1 = i++; scriptManager.Execute(ClusterBombs, b); } yield return 3.5f; cycles++; if (cycles > 2) { bossPhase = 1; } } } }