void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Boundary") || other.gameObject.CompareTag("PlayerShot") || other.gameObject.CompareTag("coins") || other.gameObject.CompareTag("bonus") ) { return; } Shake(); if (_gameController.getHP() <= 1 && !_player.protecter.activeSelf) { _gameController.DecreaseHP(); Instantiate(explosion, transform.position, transform.rotation); Destroy(gameObject); _player.destroyLazer(); Instantiate(death, deathPosition, Quaternion.identity); _gameController.backToMenu.SetActive(true); _gameController.respawn.SetActive(true); } else { _player.setShieldCount(); _player.shield.SetActive(true); _gameController.DecreaseHP(); } }
private void OnTriggerEnter(Collider other) { // if (other.name.Equals("player")) if (other.gameObject.CompareTag("Player")) { GameObject playerObject = GameObject.FindGameObjectWithTag("Player"); if (playerObject != null) { _player = playerObject.GetComponent <PlayerInputControl>(); } if (playerObject == null) { Debug.Log("Cannot find 'player' script"); } Destroy(this.gameObject); _player.destroyLazer(); // change the type of the bolt_type of player _player.setBolt_type(bolt_type); } }