Esempio n. 1
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            if (collision.gameObject.tag == PLAYER_TAG && !_gameManager.CurrentPlayer.GetComponent <Player>().HasCooldown)
            {
                GameObject.Instantiate(_explosionAnimation, collision.gameObject.transform.position, Quaternion.identity);
                GameObject.Instantiate(_explosionAnimation, gameObject.transform.position, Quaternion.identity);

                AudioSource.PlayClipAtPoint(_explosionClip, transform.position);

                //Destroy player
                GameObject.Destroy(collision.gameObject);

                //Destroy enemy
                GameObject.Destroy(gameObject);

                _gameManager.PlayerDestroyed();
            }
        }