Example #1
0
    // Update is called once per frame
    void Update()
    {
        // Pause all spawners
        if (!paused && transform.position.y < stopLine)
        {
            paused             = true;
            transform.position = new Vector2(0, stopLine);
            GameObject[] objs = GameObject.FindGameObjectsWithTag("Spawner");
            foreach (GameObject obj in objs)
            {
                SpawnObjects spawner = obj.GetComponent <SpawnObjects> ();
                if (spawner != null)
                {
                    spawner.StopMovement();
                }
                else
                {
                    BossScroller boss = obj.GetComponent <BossScroller> ();
                    if (boss != null)
                    {
                        boss.StopMovement();
                    }
                }
            }
            DestroyAllEnemies();
            BossActivate();
        }

        //TODO: Remove this
        if (paused && Input.GetKeyDown(KeyCode.G))
        {
            BossDeactivate();
        }
    }
Example #2
0
    public void CheckAllDeaths()
    {
        bool anyoneAlive = false;

        foreach (Player player in playerObjList)
        {
            if (player.deathState != DeathState.FINISHED)
            {
                anyoneAlive = true;
                break;
            }
        }
        if (!anyoneAlive)
        {
            if (easyModeOn)
            {
                foreach (Player player in playerObjList)
                {
                    player.Respawn();
                }
            }
            else
            {
                // Show retry modal
                retryPanel.enabled = true;

                // Pause all spawners
                GameObject[] objs = GameObject.FindGameObjectsWithTag("Spawner");
                foreach (GameObject obj in objs)
                {
                    SpawnObjects spawner = obj.GetComponent <SpawnObjects> ();
                    if (spawner != null)
                    {
                        spawner.StopMovement();
                    }
                    else
                    {
                        BossScroller boss = obj.GetComponent <BossScroller> ();
                        if (boss != null)
                        {
                            boss.StopMovement();
                        }
                    }
                }
            }
        }
    }
Example #3
0
    // Called from Boss script when hp < 0
    public void BossDeactivate()
    {
        GameObject[] objs = GameObject.FindGameObjectsWithTag("Spawner");
        foreach (GameObject obj in objs)
        {
            SpawnObjects spawner = obj.GetComponent <SpawnObjects> ();
            if (spawner != null)
            {
                if (spawner.transform.position.y < 6)
                {
                    Destroy(spawner.gameObject);
                    continue;
                }
                spawner.ResumeMovement();
            }
            else
            {
                BossScroller boss = obj.GetComponent <BossScroller> ();
                if (boss != null)
                {
                    boss.ResumeMovement();
                }
            }
        }
        switch (name)
        {
        case "BossFightGenie":
            gameMgr.GotoSection(2);
            break;

        case "BossFightSphinx":
            gameMgr.GotoSection(4);
            break;

        case "BossFightAladdin":
            gameMgr.GotoSection(6);
            break;
        }

        Destroy(gameObject);
    }