Exemplo n.º 1
0
    public void Dead()
    {
        if (m_DieEffect)
        {
            Instantiate(m_DieEffect, transform.position, Quaternion.identity);
        }
        if (m_Type == type.player)
        {
            if (!GameController.m_isDead)
            {
                GameObject theme = GameObject.FindGameObjectWithTag("theme");
                if (theme)
                {
                    ThemeController control = theme.GetComponent <ThemeController>();
                    if (control)
                    {
                        control.ChangeGameOverTheme();
                    }
                }
                if (m_soundControl)
                {
                    m_soundControl.PlayerClip(m_soundControl.m_playDeadClip);
                }
                GameController.m_isDead         = true;
                GameController.m_currentMaxHeal = GameController.m_MaxHealPlayer;
                transform.parent.gameObject.SetActive(false);
                Invoke("LoadMenu", 2f);
                return;
            }
            else
            {
                return;
            }
        }

        if (m_Type == type.boss)
        {
            if (m_BossControl)
            {
                m_BossControl.Dead();
                GameObject theme = GameObject.FindGameObjectWithTag("theme");
                if (theme)
                {
                    ThemeController control = theme.GetComponent <ThemeController>();
                    if (control)
                    {
                        control.ChangeWinTheme();
                    }
                }
            }
            GameController.Destroy(this);
            return;
        }

        GameObject.Destroy(gameObject);
    }