public IEnumerator<float> Phase3Script(GameObject thisShip)
        {
            if (eggs.Count > 0)
            {
                foreach (GameObject go in eggs)
                {
                    ReleaseEgg(go);
                    go.Rotation = (float)Math.PI / 2f + (((float)rand.NextDouble() * 2) - 1) * .5f;
                    go.Velocity = 20f;
                    go.LerpVelocity(80f, 6f);
                }

                eggs.Clear();

            }
            circleMoving = false;
            thisShip.LerpPosition(new Vector2(350f, 65f), 1f);
            yield return 1f;

            //CircleMovement(200f, .1f, 5f, 1f, 5f);

            float[] waitTimes = new float[]
            {
                15,
                23,
                27,
                29,
                30,
                30.5f
            };

            while (true)
            {
                // Summon all the eggs
                eggs.Clear();
                CreateEgg(1);
                CreateEgg(6);
                yield return .3f;
                CreateEgg(2);
                CreateEgg(5);
                yield return .3f;
                CreateEgg(3);
                CreateEgg(4);

                List<GameObject> tempList = eggs;

                for (int i = 0; i < 6; i++)
                {
                    // Select a random egg from the temp list to get the first slot.
                    int index = rand.Next(0, tempList.Count);
                    GameObject thisEgg = tempList[index];
                    thisEgg.CustomValue1 = waitTimes[i];
                    scriptManager.Execute(DelayedReleaseEgg, thisEgg);

                    tempList.RemoveAt(index);
                }

                // Shoot the player full of bullets for a while.
                float startTime = currentGameTime;

                while (currentGameTime < startTime + waitTimes[5])
                {
                    // Shoot
                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .6f, .35f);
                    foreach (Bullet b in mainEmitter.FireBulletCluster(VectorMathHelper.GetAngleTo(mainEmitter.Center, thisScene.player.InnerHitbox.Center), 18, 150f, 50f, 100f, Color.DarkGreen))
                    {
                        scriptManager.Execute(ToxicBulletEffect, b);
                        b.LerpVelocity(35f, 4f);
                    }

                    yield return .7f;
                }

                yield return 3f;
            }
        }
        public IEnumerator<float> Phase1Script(GameObject thisShip)
        {
            while (true)
            {
                thisShip.LerpPosition(new Vector2(350f, 65f), 3f);
                yield return 3f;
                Vulnerable = true;

                int cycles = 0;

                CircleMovement(60f, 1f, 4f);

                while (cycles < 2)
                {
                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .8f, .35f);
                    Bullet[] theseBullets = mainEmitter.FireBulletCluster((float)Math.PI / 2f, 40, 70f, 40, 100f, Color.DarkGreen);
                    foreach (Bullet b in theseBullets)
                    {
                        scriptManager.Execute(ToxicBulletEffect, b);
                    }

                    yield return 3f;

                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .6f, .35f);
                    theseBullets = mainEmitter.FireBulletCluster((float)Math.PI / 2f, 40, 70f, 40, 100f, Color.DarkGreen);
                    foreach (Bullet b in theseBullets)
                    {
                        scriptManager.Execute(ToxicBulletEffect, b);
                    }

                    yield return 2f;

                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .6f, .35f);
                    theseBullets = mainEmitter.FireBulletCluster((float)Math.PI / 2f + .75f, 40, 70f, 30, 90f, Color.DarkGreen);
                    foreach (Bullet b in theseBullets)
                    {
                        scriptManager.Execute(ToxicBulletEffect, b);
                    }

                    yield return .5f;

                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .6f, .35f);
                    theseBullets = mainEmitter.FireBulletCluster((float)Math.PI / 2f - .75f, 40, 70f, 30, 90f, Color.DarkGreen); ;
                    foreach (Bullet b in theseBullets)
                    {
                        scriptManager.Execute(ToxicBulletEffect, b);
                    }

                    yield return .5f;

                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .6f, .35f);
                    theseBullets = mainEmitter.FireBulletCluster((float)Math.PI / 2f - .45f, 20, 70f, 20, 80f, Color.DarkGreen); ;
                    foreach (Bullet b in theseBullets)
                    {
                        scriptManager.Execute(ToxicBulletEffect, b);
                    }

                    yield return .5f;

                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .6f, .35f);
                    theseBullets = mainEmitter.FireBulletCluster((float)Math.PI / 2f + .45f, 20, 70f, 20, 80f, Color.DarkGreen); ;
                    foreach (Bullet b in theseBullets)
                    {
                        scriptManager.Execute(ToxicBulletEffect, b);
                    }

                    yield return .5f;
                    cycles++;
                }

                circleMoving = false;
                LerpPosition(new Vector2(350f, 75f), .8f);
                yield return .8f;

                CircleMovement(30f, 2f, 2f);

                cycles = 0;

                while (cycles < 5)
                {
                    // Roll the angles of the shots
                    float angle1 = VectorMathHelper.GetAngleTo(arm1Emitter.Center, thisScene.player.InnerHitbox.Center, 90f);
                    float angle2 = VectorMathHelper.GetAngleTo(arm2Emitter.Center, thisScene.player.InnerHitbox.Center, 45f);
                    float angle3 = VectorMathHelper.GetAngleTo(arm3Emitter.Center, thisScene.player.InnerHitbox.Center, 10f);
                    float angle4 = VectorMathHelper.GetAngleTo(arm4Emitter.Center, thisScene.player.InnerHitbox.Center, 10f);
                    float angle5 = VectorMathHelper.GetAngleTo(arm5Emitter.Center, thisScene.player.InnerHitbox.Center, 45f);
                    float angle6 = VectorMathHelper.GetAngleTo(arm6Emitter.Center, thisScene.player.InnerHitbox.Center, 90f);

                    int shots = 0;
                    while (shots < 45)
                    {
                        Bullet b;

                        if (shots < 15)
                        {
                            AudioManager.PlaySoundEffect(GameScene.Shot2Sound, .25f, .8f);
                            b = arm1Emitter.FireBullet(angle1, 250f, Color.DarkGreen, BulletType.Arrow);
                            scriptManager.Execute(ToxicBulletEffect, b);
                            b = arm6Emitter.FireBullet(angle6, 250f, Color.DarkGreen, BulletType.Arrow);
                            scriptManager.Execute(ToxicBulletEffect, b);
                        }

                        if (shots >= 15 && shots < 30)
                        {
                            AudioManager.PlaySoundEffect(GameScene.Shot2Sound, .25f, .6f);
                            b = arm2Emitter.FireBullet(angle2, 250f, Color.DarkGreen, BulletType.Arrow);
                            scriptManager.Execute(ToxicBulletEffect, b);
                            b = arm5Emitter.FireBullet(angle5, 250f, Color.DarkGreen, BulletType.Arrow);
                            scriptManager.Execute(ToxicBulletEffect, b);
                        }

                        if (shots >= 30)
                        {
                            AudioManager.PlaySoundEffect(GameScene.Shot2Sound, .25f, .7f);
                            b = arm3Emitter.FireBullet(angle3, 250f, Color.DarkGreen, BulletType.Arrow);
                            scriptManager.Execute(ToxicBulletEffect, b);
                            b = arm4Emitter.FireBullet(angle4, 250f, Color.DarkGreen, BulletType.Arrow);
                            scriptManager.Execute(ToxicBulletEffect, b);
                        }

                        shots++;
                        yield return .03f;
                    }

                    cycles++;

                    yield return .5f;

                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .6f, .35f);
                    Bullet[] theseBullets = mainEmitter.FireBulletCluster(VectorMathHelper.GetAngleTo(mainEmitter.Center, thisScene.player.InnerHitbox.Center), 50, 80f, 120, 40f, Color.DarkGreen);
                    foreach (Bullet b in theseBullets)
                    {
                        scriptManager.Execute(ToxicBulletEffect, b);
                    }

                }

                cycles = 0;
                circleMoving = false;
            }
        }
        public IEnumerator<float> Phase2Script(GameObject thisShip)
        {
            circleMoving = false;
            thisShip.LerpPosition(new Vector2(350f, 65f), 1f);
            yield return 1f;

            CircleMovement(200f, .4f, 5f, 1f, 5f);
            CreateEgg(1);
            CreateEgg(6);

            while (true)
            {
                // First, randomize a number of volleys to fire before releasing the next egg.
                int targetVolleys = rand.Next(2, 6);
                int volleys = 0;

                while (volleys < targetVolleys)
                {
                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .6f, .35f);
                    Bullet[] theseBullets = mainEmitter.FireBulletCluster(VectorMathHelper.GetAngleTo(mainEmitter.Center, thisScene.player.InnerHitbox.Center), 40, 50f, 40, 50f, Color.DarkGreen);
                    foreach (Bullet b in theseBullets)
                    {
                        scriptManager.Execute(ToxicBulletEffect, b);
                    }

                    if (volleys == targetVolleys / 2)
                    {
                        AudioManager.PlaySoundEffect(GameScene.Shot8Sound, .8f, .35f);
                        theseBullets = mainEmitter.FireBulletExplosion(45, 130f, Color.DarkGreen);
                        foreach (Bullet b in theseBullets)
                        {
                            scriptManager.Execute(ToxicBulletEffect, b);
                        }
                    }

                    yield return 2f;

                    volleys++;
                }

                // Release the eggs being carried.
                foreach(GameObject egg in eggs)
                {
                    ReleaseEgg(egg);
                    egg.Rotation = (float)Math.PI / 2f + (((float)rand.NextDouble() * 2) - 1) * .5f;
                    egg.Velocity = 20f;
                    egg.LerpVelocity(50f, 6f);
                }

                eggs.Clear();

                // Wait and then summon some more eggs.
                yield return 1.5f;

                switch (rand.Next(0, 3))
                {
                    case(0):
                        CreateEgg(1);
                        CreateEgg(6);
                        break;
                    case(1):
                        CreateEgg(2);
                        CreateEgg(5);
                        break;
                    case(2):
                     CreateEgg(3);
                     CreateEgg(4);
                        break;
                    default:
                        break;
                }
            }
        }
Beispiel #4
0
        public IEnumerator<float> FirstKomodo(GameObject go)
        {
            yield return 2f;

            BulletEmitter be = new BulletEmitter(go, go.Center);
            be.LockedToParentPosition = true;
            be.LockPositionOffset = Vector2.Zero;

            while(true)
            {
                int shots = 0;

                while (shots < 15)
                {
                    be.FireBulletSpread(VectorMathHelper.GetAngleTo(go.Center, manager.thisScene.player.InnerHitbox.Center), 5, 70f, 220f, Color.Orange);
                    AudioManager.PlaySoundEffect(GameScene.Shot3Sound, .5f);
                    shots++;
                    yield return .3f;
                }

                yield return .5f;
                go.LerpPosition(new Vector2(500, go.Center.Y), 1.5f);
                yield return 2f;

                shots = 0;
                float turnMod = 1;
                while (shots < 20)
                {
                    if (shots > 10)
                        turnMod = -1f;

                    be.FireBulletExplosion(15, 120f, Color.DeepSkyBlue);
                    AudioManager.PlaySoundEffect(GameScene.Shot6Sound, .5f);
                    be.Rotation += .1f * turnMod;

                    shots++;
                    yield return .1f;
                }

                yield return .5f;
                go.LerpPosition(new Vector2(300, go.Center.Y), 1.5f);
                yield return 2f;
            }
        }