Example #1
0
        public IEnumerator<float> FirstKomodo(GameObject go)
        {
            yield return 3.5f;

            while (true)
            {
                int shots = 0;
                while (shots < 10)
                {
                    shots++;

                    AudioManager.PlaySoundEffect(GameScene.Shot1Sound, .7f, -.3f);
                    foreach (Bullet b in new BulletEmitter(go, go.Center, true).FireBulletExplosion(15, 80f, Color.DeepSkyBlue))
                    {
                        scriptManager.Execute(SlowHomingBullet, b);
                    }

                    yield return .4f;
                }

                yield return 2f;

                shots = 0;
                while (shots < 50)
                {
                    AudioManager.PlaySoundEffect(GameScene.Shot2Sound, .3f, 0f);
                    shots++;
                    new BulletEmitter(go, go.Center, true).FireBulletCluster((float)Math.PI / 2f, 3, 180f, 210f, 50f, Color.Orange, BulletType.DiamondSmall);

                    yield return .15f;
                }

                yield return 2f;
            }
        }
Example #2
0
        public void CollisionHandling(GameObject sender, CollisionEventArgs e)
        {
            if (CollidedObjects.Contains(sender))
                return;
            else
                CollidedObjects.Add(sender);

            // If collision occured with a player bullet...
            if (e.collisionLayer == 2)
            {
                sender.Destroy();
                // Flash the thing here.
                if (Vulnerable)
                {
                    // Flash the thing here.
                    Health--;
                }
            }

            // Collided with player; kill!
            if (e.collisionLayer == 3)
            {
                PlayerShip thisShip = (PlayerShip)e.otherObject;
                thisShip.ObjectCollidedWith(this, new CollisionEventArgs(this, 1));
            }
        }
 public void AbortObjectScripts(GameObject go)
 {
     foreach (ScriptWrapper sw in scripts.FindAll(x => x.ScriptObject == go))
     {
         sw.SetCompleted();
     }
 }
Example #4
0
        public IEnumerator<float> HeavyTortoise(GameObject go)
        {
            Enemy e = (Enemy)go;
            e.Rotation = (float)Math.PI / 2f * 3f;
            e.Health = 25f;
            e.LerpVelocity(65f, 8f);
            e.LerpRotation(e.Rotation + VectorMathHelper.GetAngleTo(e.Center, manager.thisScene.player.InnerHitbox.Center) / 2f, 12f);
            yield return 1.5f;

            BulletEmitter mainEmitter = new BulletEmitter(e, e.Center, false);
            mainEmitter.LockedToParentPosition = true;
            mainEmitter.LockPositionOffset = Vector2.Zero;
            yield return .01f;
            while(true)
            {
                int shots  = 0;
                while (shots < 20)
                {
                    if(manager.thisScene.PointOnScreen(go.Center))
                        AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .25f);

                    mainEmitter.FireBulletCluster(VectorMathHelper.GetAngleTo(mainEmitter.Center, manager.thisScene.player.InnerHitbox.Center), 1, 10f, 150f, 0f, Color.DeepSkyBlue);
                    shots++;
                    yield return .06f;
                }

                yield return 1.73f;
            }
        }
Example #5
0
        public IEnumerator<float> FirstKomodo(GameObject go)
        {
            go.Rotation = (float)Math.PI / 2f;
            go.Velocity = 35f;
            yield return 1.5f;
            go.LerpVelocity(0f, 1.5f);
            yield return 1.5f;

            BulletEmitter emitter = new BulletEmitter(go, go.Center);
            while (true)
            {
                int shots = 0;
                while(shots < 10)
                {
                    shots++;

                    emitter.Rotation += .2f;
                    AudioManager.PlaySoundEffect(GameScene.Shot8Sound, .7f, .5f);
                    foreach(Bullet b in emitter.FireBulletExplosion(20, 200f, Color.DeepSkyBlue))
                    {
                        b.LerpVelocity(40f, 4f);
                    }

                    yield return .2f;
                }

                yield return 4f;
            }
        }
Example #6
0
        public IEnumerator<float> DisposePhantom(GameObject go)
        {
            Phantom phantom = (Phantom)go;

            scriptManager.Execute(phantom.PhaseOut, go);
            yield return 2f;
            phantom.Destroy();
        }
Example #7
0
 public IEnumerator<float> BombExplosion(GameObject go)
 {
     yield return 2f;
     AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .9f, 0f);
     BulletEmitter explosion = new BulletEmitter(this, go.Center, true);
     explosion.FireBulletExplosion(20, 110f, Color.Lerp(Color.White, Color.Orange, .7f));
     explosion.FireBulletExplosion(30, 130f, Color.Lerp(Color.White, Color.Orange, .7f), BulletType.CircleSmall);
     go.Destroy();
 }
Example #8
0
        public virtual IEnumerator<float> CustomExplosion(GameObject go)
        {
            Texture = null;
            Rotation = 0;
            Velocity = 0;

            yield return 0f;
            Destroy();
        }
Example #9
0
 public IEnumerator<float> KomodoStrafeBlue(GameObject go)
 {
     while (true)
     {
         new BulletEmitter(go, go.Center, true).FireBullet(0f, 150f, Color.DeepSkyBlue).LerpVelocity(50f, 3f);
         new BulletEmitter(go, go.Center, true).FireBullet((float)Math.PI, 150f, Color.DeepSkyBlue).LerpVelocity(50f, 3f);
         yield return .24f;
     }
 }
Example #10
0
 public static IEnumerator<float> ToxicBulletEffect(GameObject thisObject)
 {
     while (true)
     {
         thisObject.LerpColor(Color.LimeGreen, .7f);
         yield return .7f;
         thisObject.LerpColor(Color.DarkGreen, .7f);
         yield return .4f;
     }
 }
Example #11
0
        public ScriptWrapper(GameObjectScript newScript, GameObject go, bool initialized = false)
        {
            thisScript = newScript(go);
            State = ScriptState.Running;
            SleepTime = 0f;

            IsObjectScript = true;
            ScriptObject = go;

            Initialized = initialized;
        }
Example #12
0
        public IEnumerator<float> DragonflyDelayedShoot(GameObject go)
        {
            yield return go.CustomValue2;

            while (true)
            {
                AudioManager.PlaySoundEffect(GameScene.Shot5Sound, .6f, 0f);
                new BulletEmitter(go, go.Center, true).FireBulletCluster(VectorMathHelper.GetAngleTo(go.Center, manager.thisScene.player.InnerHitbox.Center), 1, 10f, 130f, 150f, Color.Orange);
                yield return go.CustomValue1;
            }
        }
Example #13
0
        public BulletEmitter(GameObject newParent, Vector2 newPosition, bool oneshot = false, BulletEmitterType type = BulletEmitterType.Invisible)
        {
            Parent = newParent;
            thisScene = newParent.thisScene;
            Center = newPosition;
            Type = type;

            if (oneshot)
                FlaggedForRemoval = true;

            Initialize();
        }
Example #14
0
        public IEnumerator<float> KomodoStrafe(GameObject go)
        {
            while (true)
            {
                if(manager.thisScene.PointOnScreen(go.Center))
                    AudioManager.PlaySoundEffect(GameScene.Shot6Sound, .45f, .4f);

                new BulletEmitter(go, go.Center, true).FireBullet(0f, 150f, Color.Orange).LerpVelocity(50f, 3f);
                new BulletEmitter(go, go.Center, true).FireBullet((float)Math.PI, 150f, Color.Orange).LerpVelocity(50f, 3f);
                yield return .24f;
            }
        }
Example #15
0
        // Stores the script manager that belongs to the parent if it exists
        public Bullet(GameObject newParent, Vector2 newPosition, float newRotation, float newVelocity, Color newColor, BulletType type = BulletType.CircleSmall)
        {
            parent = newParent;

            // Because the Origin does not exist yet, set Position here and update it later once Origin exists.
            Position = newPosition;

            Rotation = newRotation;
            Velocity = newVelocity;

            Color = newColor;
            bulletType = type;

            Initialize();
        }
Example #16
0
        public void CollisionHandling(GameObject sender, CollisionEventArgs e)
        {
            if (CollidedObjects.Contains(sender))
            {
                return;
            }
            else
                CollidedObjects.Add(sender);

            // If collision occured with a player bullet...
            //if (e.collisionLayer == 2)
            //{
                //sender.Destroy();
                // Flash the thing here.
                //Health--;
            //}
        }
Example #17
0
        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();
        }
Example #18
0
        public IEnumerator<float> EasyTortoise(GameObject go)
        {
            if (go.CustomValue2 == 0)
                go.Rotation = (float)Math.PI / 2f;
            else
                go.Rotation = go.CustomValue2;
            go.Velocity = 75f;
            go.LerpVelocity(45f, 5f);

            yield return go.CustomValue1;
            while (true)
            {
                AudioManager.PlaySoundEffect(GameScene.Shot8Sound, .7f, 0f);
                new BulletEmitter(go, go.Center, true).FireBulletExplosion(12, 80f, Color.DeepSkyBlue);
                yield return 2f;
            }
        }
Example #19
0
        public void CollisionHandling(GameObject sender, CollisionEventArgs e)
        {
            if (CollidedObjects.Contains(sender))
                return;
            else
                CollidedObjects.Add(sender);

            // If collision occured with a player bullet...
            if (e.collisionLayer == 2)
            {
                sender.Destroy();
                // Flash the thing here.
                Health--;

                if (Health <= 0)
                    Explode();
            }
        }
Example #20
0
        public IEnumerator<float> BulletFountain(GameObject go)
        {
            BulletEmitter thisEmitter = new BulletEmitter(go, go.Center, false);
            thisEmitter.LockedToParentPosition = true;
            thisEmitter.LockPositionOffset = Vector2.Zero;

            yield return go.CustomValue1;
            float timeToFire = go.CustomValue2;

            float startTime = manager.thisScene.currentGameTime;
            while (manager.thisScene.currentGameTime < startTime + timeToFire)
            {
                if(manager.thisScene.PointOnScreen(go.Center))
                    AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .1f, -.3f);

                thisEmitter.FireBulletCluster(VectorMathHelper.GetAngleTo(go.Center, manager.thisScene.player.InnerHitbox.Center), 1, 10f, (float)Math.Max(100, go.CustomValue3), 0f, Color.DeepSkyBlue);
                yield return .06f;
            }
        }
Example #21
0
        public IEnumerator<float> CircleSquadKomodo(GameObject go)
        {
            if (go.CustomValue2 < 200)
                go.CustomValue2 = 200;

            yield return 2f + (go.CustomValue1 * 1.1f);

            while (true)
            {
                if (Vector2.Distance(manager.thisScene.player.InnerHitbox.Center, circleSquadOrigin) > go.CustomValue2)
                {
                    AudioManager.PlaySoundEffect(GameScene.Shot6Sound, .8f);
                    new BulletEmitter(go, go.Center, true).FireBulletCluster(VectorMathHelper.GetAngleTo(go.Center, manager.thisScene.player.InnerHitbox.Center), 15, 35f, 200f, 50f, Color.DeepSkyBlue);
                }
                else
                {
                    AudioManager.PlaySoundEffect(GameScene.Shot3Sound, .3f);
                    new BulletEmitter(go, go.Center, true).FireBullet(VectorMathHelper.GetAngleTo(go.Center, manager.thisScene.player.InnerHitbox.Center), 100f, Color.DeepSkyBlue);
                }
                yield return 2f;
            }
        }
Example #22
0
        public void CollisionHandling(GameObject sender, CollisionEventArgs e)
        {
            if (CollidedObjects.Contains(sender))
            {
                return;
            }
            else
                CollidedObjects.Add(sender);

            // If collision occured with a player bullet...
            if (e.collisionLayer == 2)
            {
                sender.Destroy();
                // Flash the thing here.
                Health--;
                CheckForDeath();
            }
            else if (e.collisionLayer == 3)
            {
                Health -= 2;
                CheckForDeath();
            }
        }
Example #23
0
 public void Execute(GameObjectScript newScript, GameObject go, bool initialized = false)
 {
     scripts.Add(new ScriptWrapper(newScript, go, initialized));
 }
Example #24
0
        public IEnumerator<float> TortoiseExplosiveShot(GameObject go)
        {
            yield return 1.5f;
            while (true)
            {
                foreach (Bullet b in new BulletEmitter(go, go.Center, true).FireBulletExplosion(10, 200f, Color.DeepSkyBlue))
                {
                    AudioManager.PlaySoundEffect(GameScene.Shot1Sound, .7f);
                    b.LerpVelocity(100f, 2f);
                }

                yield return 2.72f;
            }
        }
Example #25
0
 public IEnumerator<float> SimplePlayerSpreadShot(GameObject go)
 {
     while (true)
     {
         yield return go.CustomValue1;
         AudioManager.PlaySoundEffect(GameScene.Shot2Sound, .4f);
         new BulletEmitter(go, go.Center, true).FireBulletSpread(VectorMathHelper.GetAngleTo(go.Center, manager.thisScene.player.InnerHitbox.Center), (int)go.CustomValue2, go.CustomValue3, go.CustomValue4, Color.DeepSkyBlue);
     }
 }
Example #26
0
 public IEnumerator<float> SimplePlayerShot(GameObject go)
 {
     while (true)
     {
         yield return go.CustomValue1;
         AudioManager.PlaySoundEffect(GameScene.Shot6Sound, 1f);
         new BulletEmitter(go, go.Center, true).FireBullet(VectorMathHelper.GetAngleTo(go.Center, manager.thisScene.player.InnerHitbox.Center), go.CustomValue2, Color.Orange);
     }
 }
Example #27
0
 public void OuterCollision(GameObject sender, CollisionEventArgs e)
 {
     if (OnOuterCollision != null)
         OnOuterCollision(sender, e);
 }
Example #28
0
        public void ObjectGrazed(GameObject sender, CollisionEventArgs e)
        {
            // If the object grazed was a bullet, graze it and report the graze.
            if (sender is Bullet)
            {
                Bullet thisBullet = (Bullet)sender;
                if (!thisBullet.Grazed)
                {
                    thisBullet.Grazed = true;
                    thisScene.GrazeCount++;
                    thisScene.Score += thisScene.GrazeValue;

                    thisScene.GainExperience(1f);
                    thisScene.PauseExperienceDecay(1f);
                }
                return;
            }
        }
Example #29
0
        public void ObjectCollidedWith(GameObject sender, CollisionEventArgs e)
        {
            if (!Phasing && (sender is Bullet || sender is Enemy || sender is Boss))
            {
                Phasing = true;
                thisScene.PlayAnimation(new Animation(GameScene.PlayerExplosionTexture, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, 48, 20f, new Vector2(Center.X - 24, Center.Y - 25), false));
                AudioManager.PlaySoundEffect(GameScene.Explosion3Sound, .8f);

                thisScene.ResetRank();
                thisScene.scriptManager.Execute(thisScene.TryRespawn);

                Destroy();
            }
        }
Example #30
0
        public IEnumerator<float> FinalPhase(GameObject go)
        {
            // Do explosions and lerp the position dramatically.
            LerpPosition(new Vector2(350f, 75f), 5f);
            ring1.LerpAngularVelocity(0f, 3f);
            ring2.LerpAngularVelocity(0f, 4f);
            yield return 5f;
            // Lerp the position and disable the player's shot
            thisScene.player.CanFire = false;
            thisScene.PlayerCanFire = false;
            ring1.LerpAngularVelocity(2.15f, 3f);
            ring2.LerpAngularVelocity(-3.25f, 3f);
            yield return 6f;

            // Start a 60 second countdown timer.
            float finalPhaseEndTime = currentGameTime + 58f;
            float nextShotTime = currentGameTime + 2.5f;

            //BEGIN!
            scriptManager.Execute(FinalPhaseMovement, this);

            while (finalPhaseEndTime - currentGameTime > 42f)
            {
                Bullet b;
                AudioManager.PlaySoundEffect(GameScene.Shot4Sound, .25f, .25f);
                foreach (BulletEmitter be in ring2Emitters)
                {
                    b = be.FireBullet(270f, Color.DeepSkyBlue);
                    b.LerpVelocity(200f, 1.5f);
                }

                if (currentGameTime >= nextShotTime && finalPhaseEndTime - currentGameTime > 47f)
                {
                    foreach(BulletEmitter be in ring1Emitters)
                    {
                        AudioManager.PlaySoundEffect(GameScene.Shot6Sound, .15f, 0f);
                        be.FireBulletSpread(be.Rotation, 5, 90f, 40f, Color.Red);
                        nextShotTime = currentGameTime + .7f;
                    }
                }

                yield return .03f;
            }

            yield return 2f;

            float rotationSpeed = .4f;
            float phase2StartTime = currentGameTime;

            while(finalPhaseEndTime - currentGameTime  > 22f)
            {
                mainEmitter.Rotation = VectorMathHelper.GetRandom();
                // Do some movementing while this happens
                AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .9f, .5f);

                foreach (Bullet b in mainEmitter.FireBulletExplosion(15, 100f, Color.DeepSkyBlue))
                {
                    b.CustomValue1 = rotationSpeed;
                    b.CustomValue2 = 0f;
                    b.CustomValue3 = mainEmitter.Center.X;
                    b.CustomValue4 = mainEmitter.Center.Y;

                    rotatingBullets.Add(b);
                }

                foreach (Bullet b in mainEmitter.FireBulletExplosion(15, 100f, Color.Red))
                {
                    b.CustomValue1 = rotationSpeed * -1f;
                    b.CustomValue2 = 0f;
                    b.CustomValue3 = mainEmitter.Center.X;
                    b.CustomValue4 = mainEmitter.Center.Y;

                    rotatingBullets.Add(b);
                }

                yield return .5f;
            }

            yield return 2f;

            int shots = 0;
            float waitTime = .06f;
            nextShotTime = currentGameTime + 2f;

            rotationSpeed = .3f;

            while (finalPhaseEndTime - currentGameTime > 0f)
            {
                if (shots < 10)
                {
                    AudioManager.PlaySoundEffect(GameScene.Shot3Sound, .3f, .5f);
                    Bullet[] tempbullets = mainEmitter.FireBulletExplosion(35, 40, Color.Orange);
                    foreach (Bullet b in tempbullets)
                    {
                        b.LerpVelocity(260f, 3.5f);
                    }

                    shots++;
                    waitTime = .06f;
                }
                else
                {
                    mainEmitter.Rotation = VectorMathHelper.GetRandom();
                    waitTime = .5f;
                    shots = 0;
                }

                if (currentGameTime > nextShotTime)
                {
                    AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .9f, .5f);

                    foreach (Bullet b in mainEmitter.FireBulletExplosion(10, 60f, Color.DeepSkyBlue))
                    {
                        b.CustomValue1 = rotationSpeed;
                        b.CustomValue2 = 0f;
                        b.CustomValue3 = mainEmitter.Center.X;
                        b.CustomValue4 = mainEmitter.Center.Y;

                        rotatingBullets.Add(b);
                    }

                    foreach (Bullet b in mainEmitter.FireBulletExplosion(10, 60f, Color.Red))
                    {
                        b.CustomValue1 = rotationSpeed * -1f;
                        b.CustomValue2 = 0f;
                        b.CustomValue3 = mainEmitter.Center.X;
                        b.CustomValue4 = mainEmitter.Center.Y;

                        rotatingBullets.Add(b);
                    }

                    nextShotTime += .75f;
                }

                yield return waitTime;
            }

            yield return 3f;

            // Now explode for real
        }