Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("enemy") && _type == BulletType.player)
        {
            //destroy enemy
            Destroy(other.gameObject);

            //destroy bullet
            Destroy(gameObject);

            if (_gameManager)
            {
                _gameManager.IncreateScore();
            }
        }
        else if (other.gameObject.CompareTag("Player") && _type == BulletType.enemy)
        {
            //destroy bullet
            Destroy(gameObject);

            //end game
            _gameManager.ShowGameOver();
        }
    }