Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Player")
        {
            bossController.isActive = true;
            GameObject player = col.gameObject;

            // Make sure we send the parent object
            // root never returns null, if this Transform doesn't have a parent it returns itself.
            if (player.transform.root.gameObject != player)
            {
                player = player.transform.root.gameObject;
            }
            bossController.SetPlayerObject(player);
            bossController.BeginBossBattle();

            //fade out music, disable ambience
            StartCoroutine(ChangeMusic());
            ambience.SetActive(false);
            if (!isPlayed)
            {
                StartCoroutine(PlayMusic());
                isPlayed = true;
            }
        }
    }