void OnTriggerEnter2D(Collider2D other)
    {
        bool check = (other.gameObject.tag == "Ground") ||
                     (other.gameObject.tag == "Kunai") ||
                     (other.gameObject.tag == "Ball") ||
                     (other.gameObject.tag == "Bomb") ||
                     (other.gameObject.tag == "Coin");

        if (check)
        {
            Destroy(other.gameObject);
        }

        if ((other.gameObject.tag == "Background"))
        {
            other.gameObject.transform.position = new Vector3(5.36f, 0.2751735f, 0);
        }

        if (other.gameObject.tag == "Player")
        {
            Player.PlayerChangeState("Dead");
            SoundManager.GetInstance().PlaySFX(SoundManager.SOUND_PLAYER_DEAD);
            if (_uiManager != null)
            {
                _uiManager.SlideDown("GameOverState");
            }
        }
    }
Exemple #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Player")
        {
            Destroy(gameObject);
            Instantiate(_explosiveEffect, transform.position, Quaternion.identity);
            Player.PlayerChangeState("Dead");
            GameManager.SetGameOver(true);
            SoundManager.GetInstance().PlaySFX(SoundManager.SOUND_PLAYER_DEAD);
            //			InGameUIManager.SlideDown("GameOverState");

            // One
            //			_instances_InGame.SlideDown("GameOverState");
            //---
            // Two
            _ingame.SlideDown("GameOverState");
            //----
        }
        else if (other.gameObject.tag == "Attack")
        {
            Destroy(gameObject);
            Destroy(other.gameObject);
        }
    }