//to send the DamageDealer details
    public void CollideWith(DamageDealer damageDealers)
    {
        obstacleHealth -= damageDealers.GetDamageWaveBullets();

        Destroy(gameObject);

        AudioSource.PlayClipAtPoint(obstacleSound, Camera.main.transform.position, obstacleSoundEffect);

        WhenObstacleDie();
    }
Beispiel #2
0
    //when HitPlayer() is called, send the DamageDealer details
    //when the player gets hit by the obstacles, destroy the player
    private void HitPlayer(DamageDealer dealDamage)
    {
        playerHealthPoints -= dealDamage.GetDamageWaveBullets();

        dealDamage.Hit();

        AudioSource.PlayClipAtPoint(playerHealthReduction, Camera.main.transform.position, playerHealthReductionRangeVolume);

        When2D_CarPlayerDie();

        AudioSource.PlayClipAtPoint(playerHealthReduction, Camera.main.transform.position, playerHealthReductionRangeVolume);
    }