Exemple #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Bolt")
        {
            _bossController.bossLives--;
            Instantiate(explosion, transform.position, transform.rotation);
            _bossController.UpdateBossLives();
            Debug.Log("Boss Lives updated");
            //_bossController.PlayerHit();
            if (_bossController.bossLives < 1)
            {
                Debug.Log("No lives remainning");
                //bossDestroyed.Play(bossDestroy);
                _bossController.BossDestroyed();
                _gameController.AddScore(scoreValue);
                //explosionParticle.Play(true);
                Instantiate(explosionParticle, transform.position, transform.rotation);
                CameraShaker.Instance.ShakeOnce(4f, 4f, .1f, 1f);
                _gameController.StopAllCoroutine();
                CancelInvoke();
                _gameController.AddScore(scoreValue);
            }
            Destroy(this.gameObject, 2000f);
        }

        if (other.tag == "Player")
        {
            _gameController.lives--;
            _gameController.UpdateLives();
            Debug.Log("Lives updated");
            _gameController.PlayerHit();
            if (_gameController.lives < 1)
            {
                Debug.Log("No lives remainning");
                _gameController.GameOver();
            }
            Destroy(this.gameObject, 1f);
        }
    }