예제 #1
0
 // Use this for initialization
 void Start()
 {
     testBoss = GetComponent <TestBoss> ();
     timer    = GetComponent <Timer> ();
     rbody    = GetComponent <Rigidbody2D> ();
     SwitchToRandomState();
     timer.Begin();
     rotation = 0;
     step     = 0;
     speed    = 20;      // should this inherit from TestBoss.cs? MoveTo feels faster than our other speeds, not sure why.
 }
예제 #2
0
        public TestEmployee Get(int id)
        {
            int index = id - 1;

            index = (index < 0) ? 0 : index;

            if (this._data.ElementAtOrDefault(index) != null)
            {
                TestBoss row = this._data.ElementAt(index);

                row.Employees = _employeeService.GetAll();

                return(row);
            }

            throw new ObjectNotFoundException("could not locate boss with id " + id);
        }
예제 #3
0
        public HttpResponseMessage TestInjectedBossService(int employeeId)
        {
            TestBoss boss = null;

            try
            {
                //  we have to cast this to TestBoss explicitly because the interface specifies a TestEmployee. TestBoss inherits from TestEmployee.
                boss = (TestBoss)_bossService.Get(employeeId);
            }
            catch (ObjectNotFoundException ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message));
            }

            ItemResponse <TestBoss> response = new ItemResponse <TestBoss>();

            response.Item = boss;

            return(Request.CreateResponse(response));
        }
    private void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log(other);
        if (other.CompareTag("SceneChange"))
        {
            Debug.Log("Scene Changed to BossScene");
            SceneManager.LoadScene(sceneToLoad);
        }
        if (other.CompareTag("Gluttony"))
        {
            //Debug.Log("Collided");
            PlayerMovement playerMov    = player.GetComponent <PlayerMovement>();
            ActorHealth    playerHealth = player.GetComponent <ActorHealth>();
            TestBoss       gluttonyMov  = gluttony.GetComponent <TestBoss>();
            playerMov.velocity += Vector2.Scale(gluttonyMov.movementDirection, 10.0f *
                                                new Vector2((Mathf.Log(1f / (Time.deltaTime * playerMov.Drag.x + 1)) / -Time.deltaTime), (Mathf.Log(1f / (Time.deltaTime * playerMov.Drag.y + 1)) / -Time.deltaTime)));

            if (gluttonyMov.state == TestBoss.State.Walk)
            {
                // reduces player health by 1 when gluttony is walking
                playerHealth.takeDamage(1);
            }
            else if (gluttonyMov.state == TestBoss.State.Crushed)
            {
                // reduces player health by 5 when gluttony is slamming/crushing
                playerHealth.takeDamage(3);
            }
        }
        if (other.CompareTag("Gluttony Projectile"))
        {
            ActorHealth playerHealth = player.GetComponent <ActorHealth>();
            playerHealth.takeDamage(3);
        }
        if (other.CompareTag("Gluttony Bite"))
        {
            ActorHealth playerHealth = player.GetComponent <ActorHealth>();
            playerHealth.takeDamage(1);
        }
    }
예제 #5
0
        public override IEnumerator <float> LevelScript()
        {
            manager.thisScene.fader.LerpColor(Color.Transparent, 1f);
            Enemy e;

            AudioManager.PlaySong(Level1Theme, false, .5f);

            TitleShown = true;
            manager.thisScene.LerpTitleColor(Color.White, 1f);
            yield return(1f);

            yield return(2f);

            manager.thisScene.LerpTitleColor(Color.Transparent, 1f);
            yield return(1f);

            TitleShown = false;

            // A wave of downward enemies
            for (int i = 0; i < 5; i++)
            {
                e          = SpawnEnemy(EnemyType.Slicer, new Vector2(100 + 100 * i, -40));
                e.Velocity = 100f;

                e.CustomValue1 = 3f;
                e.CustomValue2 = 100f;

                yield return(.8f);
            }

            yield return(.5f);

            // Level time: 8.5 seconds

            // Enemies coming in from the sides at an angle with homing shots
            e = SpawnEnemyAtAngle(EnemyType.Slicer, new Vector2(manager.thisScene.ScreenArea.Width + 60, 25), (float)Math.PI / 4 * 3, 70);
            e.CustomValue1 = .9f;
            e.CustomValue2 = 100;
            scriptManager.Execute(SimplePlayerShot, e);
            yield return(1f);

            e = SpawnEnemyAtAngle(EnemyType.Slicer, new Vector2(-60, 25), (float)Math.PI / 4, 70);
            e.CustomValue1 = .9f;
            e.CustomValue2 = 100;
            scriptManager.Execute(SimplePlayerShot, e);
            yield return(1f);

            e = SpawnEnemyAtAngle(EnemyType.Slicer, new Vector2(manager.thisScene.ScreenArea.Width + 60, 55), (float)Math.PI / 4 * 3, 70);
            e.CustomValue1 = .9f;
            e.CustomValue2 = 100;
            scriptManager.Execute(SimplePlayerShot, e);
            yield return(1f);

            e = SpawnEnemyAtAngle(EnemyType.Slicer, new Vector2(-60, 55), (float)Math.PI / 4, 70);
            e.CustomValue1 = .9f;
            e.CustomValue2 = 100;
            scriptManager.Execute(SimplePlayerShot, e);

            yield return(4f);

            // Level time: 15.5 seconds
            List <Enemy> enemygroup = new List <Enemy>();

            // Spawn a larger group of 5 enemies from the top to drop toward the middle before beginning to fire spread shots
            for (int i = 0; i < 3; i++)
            {
                e = SpawnEnemy(EnemyType.Slicer, new Vector2(250 + 50 * i, -40));
                enemygroup.Add(e);
                e.Health = 5;
                e.LerpPosition(new Vector2(e.Center.X, 250), 3f);
                e.CustomValue1 = 1.5f;
                e.CustomValue2 = 3;
                e.CustomValue3 = 50f;
                e.CustomValue4 = 140f;

                scriptManager.Execute(SimplePlayerSpreadShot, e);
            }
            for (int i = 0; i < 2; i++)
            {
                e = SpawnEnemy(EnemyType.Slicer, new Vector2(275 + 50 * i, -80));
                enemygroup.Add(e);
                e.Health = 5;
                e.LerpPosition(new Vector2(e.Center.X, 210), 3f);

                e.CustomValue1 = 2f;
                e.CustomValue2 = 3;
                e.CustomValue3 = 50f;
                e.CustomValue4 = 140f;

                scriptManager.Execute(SimplePlayerSpreadShot, e);
            }

            yield return(3f);

            // Level time: 18.5

            // Spawn a larger group of 5 enemies from the top to drop toward the middle before beginning to fire spread shots
            for (int i = 0; i < 3; i++)
            {
                e = SpawnEnemy(EnemyType.Slicer, new Vector2(100 + 50 * i, -40));
                enemygroup.Add(e);
                e.Health = 3;
                e.LerpPosition(new Vector2(e.Center.X, 350), 3f);
                e.CustomValue1 = 1.5f;
                e.CustomValue2 = 3;
                e.CustomValue3 = 50f;
                e.CustomValue4 = 140f;

                scriptManager.Execute(SimplePlayerSpreadShot, e);
            }
            for (int i = 0; i < 2; i++)
            {
                e = SpawnEnemy(EnemyType.Slicer, new Vector2(125 + 50 * i, -80));
                enemygroup.Add(e);
                e.Health = 3;
                e.LerpPosition(new Vector2(e.Center.X, 310), 3f);

                e.CustomValue1 = 2f;
                e.CustomValue2 = 3;
                e.CustomValue3 = 50f;
                e.CustomValue4 = 140f;

                scriptManager.Execute(SimplePlayerSpreadShot, e);
            }

            yield return(2f);

            // Level time: 20.5

            // Spawn a larger group of 5 enemies from the top to drop toward the middle before beginning to fire spread shots
            for (int i = 0; i < 3; i++)
            {
                e = SpawnEnemy(EnemyType.Slicer, new Vector2(425 + 50 * i, -40));
                enemygroup.Add(e);
                e.Health = 3;
                e.LerpPosition(new Vector2(e.Center.X, 350), 3f);
                e.CustomValue1 = 1.5f;
                e.CustomValue2 = 3;
                e.CustomValue3 = 50f;
                e.CustomValue4 = 140f;

                scriptManager.Execute(SimplePlayerSpreadShot, e);
            }
            for (int i = 0; i < 2; i++)
            {
                e = SpawnEnemy(EnemyType.Slicer, new Vector2(450 + 50 * i, -80));
                enemygroup.Add(e);
                e.Health = 3;
                e.LerpPosition(new Vector2(e.Center.X, 310), 3f);

                e.CustomValue1 = 2f;
                e.CustomValue2 = 3;
                e.CustomValue3 = 50f;
                e.CustomValue4 = 140f;

                scriptManager.Execute(SimplePlayerSpreadShot, e);
            }

            yield return(5f);

            // Level time: 25.5

            foreach (Enemy enemy in enemygroup)
            {
                enemy.LerpVelocity(100f, 3f);
            }

            yield return(3f);

            // Level time 28.5

            // Spawn a tortoise from below a couple times, and then add a couple from above
            e = SpawnEnemyAtAngle(EnemyType.Tortoise, new Vector2(55, 655), ((float)Math.PI / 2f) * -.8f, 40f);
            scriptManager.Execute(TortoiseExplosiveShot, e);
            yield return(2.5f);

            e = SpawnEnemyAtAngle(EnemyType.Tortoise, new Vector2(555, 655), (((float)Math.PI / 2f) * -.3f) - ((float)Math.PI / 2), 40f);
            scriptManager.Execute(TortoiseExplosiveShot, e);
            yield return(3f);

            e = SpawnEnemy(EnemyType.Tortoise, new Vector2(200f, -50f));
            e.LerpVelocity(40f, 4f);
            scriptManager.Execute(TortoiseExplosiveShot, e);

            e = SpawnEnemy(EnemyType.Tortoise, new Vector2(400f, -50f));
            e.LerpVelocity(40f, 4f);
            scriptManager.Execute(TortoiseExplosiveShot, e);

            // Level time: 34

            yield return(2f);

            // Level time 36

            for (int i = 0; i < 12; i++)
            {
                float x;
                if (i % 2 == 0)
                {
                    x = -40;
                }
                else
                {
                    x = 740;
                }

                Vector2 spawnPoint = new Vector2(x, 100 + (15 * i));

                e = SpawnEnemyAtAngle(EnemyType.Dragonfly, spawnPoint, VectorMathHelper.GetAngleTo(spawnPoint, manager.thisScene.player.InnerHitbox.Center), 130f);
                yield return(.5f);
            }

            //Level time 42
            Random rand = new Random();

            for (int i = 0; i < 15; i++)
            {
                e          = SpawnEnemy(EnemyType.Slicer, new Vector2(rand.Next(50, 600), -50));
                e.Velocity = 200f;
                e.LerpVelocity(55f, 2f);
                e.CustomValue1 = 1.25f;
                e.CustomValue2 = 135f;
                scriptManager.Execute(SimplePlayerShot, e);

                yield return(.5f);
            }

            // Level time 49.5

            yield return(1.5f);

            // A tortoise from below that will track the player with its cannons as it moves
            e          = SpawnEnemy(EnemyType.Tortoise, new Vector2(250, 680));
            e.Rotation = (float)Math.PI / 2f * 3f;
            scriptManager.Execute(HeavyTortoise, e);

            yield return(4f);

            // A tortoise from below that will track the player with its cannons as it moves
            e          = SpawnEnemy(EnemyType.Tortoise, new Vector2(550, 680));
            e.Rotation = (float)Math.PI / 2f * 3f;
            scriptManager.Execute(HeavyTortoise, e);

            yield return(4f);

            yield return(6f);

            manager.thisScene.PlayBossWarning();
            yield return(6.6f);

            //SPAWN THE BOSS
            Boss boss = new TestBoss(manager.thisScene, new Vector2(350f, -20f));

            BeginBossBattle(boss);
            yield return(1f);

            bossTheme = AudioManager.PlaySong(BossTheme);

            while (boss.Health > 0)
            {
                yield return(.03f);
            }

            // Stop the boss theme and hide the health bar
            bossTheme.Dispose();
            manager.thisScene.HideBossHealthbar();

            // Explode the boss!!
            scriptManager.AbortObjectScripts(boss);
            manager.thisScene.player.Phasing = true;
            foreach (GameObject b in manager.thisScene.gameObjects.FindAll(x => x is Bullet))
            {
                scriptManager.AbortObjectScripts(b);
                b.Phasing = true;
                b.LerpColor(Color.Transparent, 1f);
            }

            scriptManager.Execute(manager.thisScene.BossExplosion, boss);
            yield return(3.3f);

            yield return(2f);

            manager.thisScene.fader.LerpColor(Color.Transparent, 3f);
            yield return(3f);

            manager.thisScene.fader.LerpColor(Color.Black, 2f);


            yield return(2f);

            manager.thisScene.player.Phasing = false;
            manager.SetLevel(2);
        }
예제 #6
0
 void Awake()
 {
     Instance = this;
 }