Example #1
0
 void ProcessHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     if (health <= 0)
     {
         gameSession.UpdateScore(winPoints);
         AudioSource.PlayClipAtPoint(enemyDieSound, Camera.main.transform.position, enemyDieVolume);
         Explode();
     }
 }
Example #2
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     if (health <= 0)
     {
         FindObjectOfType <SceneLoader>().LoadGameOver();
         Destroy(gameObject);
         AudioSource.PlayClipAtPoint(PlayerDeathSound, Camera.main.transform.position, volume);
     }
 }
Example #3
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     if (health <= 0)
     {
         Destroy(gameObject);
         Instantiate(particleDeathEffect, transform.position, Quaternion.identity); // here i could also use transform.rotation instead of quaternion.identity
         Destroy(particleDeathEffect, particleLifeSpan);
     }
 }
Example #4
0
    private void ProcessHit(DamageDealer damageDealer)
    {
        health -= damageDealer.GetDamage();

        damageDealer.Hit();

        if (health <= 0)
        {
            Destroy(gameObject);
        }
    }
Example #5
0
    // process enemy health
    private void ProcessHit(DamageDealer damageDealer)
    {
        health -= damageDealer.GetDamage();
        damageDealer.Hit();
        // FindObjectOfType<GameSession>().AddToScore(scoreValue);

        if (health <= 0)
        {
            Die();
        }
    }
Example #6
0
    private void OnTriggerEnter2D(Collider2D otherObject)
    {
        DamageDealer dmgDealer = otherObject.gameObject.GetComponent <DamageDealer>();

        health -= dmgDealer.GetDamage();

        if (health <= 0)
        {
            Die();
        }
    }
    // Send DamageDealer details
    private void ProcessHit(DamageDealer dmgDealer)
    {
        health -= dmgDealer.GetDamage();
        AudioSource.PlayClipAtPoint(collisionSound, Camera.main.transform.position, SoundVolume);
        FindObjectOfType <Health>().UpdateHealth(health);

        if (health <= 0)
        {
            Die();
        }
    }
Example #8
0
    private void ProcessHit(DamageDealer dmg)
    {
        health -= dmg.GetDamage();

        AudioSource.PlayClipAtPoint(PlayerHealthReduced, Camera.main.transform.position, PlayerHealthReduction);

        if (health <= 0)
        {
            Die();
        }
    }
Example #9
0
 private void HitProcess(DamageDealer damage)
 {
     health -= damage.GetDamage();
     damage.Hit();
     if (health <= 0)
     {
         FindObjectOfType <Spaceship>().Die(gameObject);
         FindObjectOfType <EnemySpawner>().EnemyDecreased();
         gameSession.AddToScore(scoreValue);
     }
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        DamageDealer damageDealer = collision.gameObject.GetComponent <DamageDealer>();

        damage = damageDealer.GetDamage();
        if (!damageDealer)
        {
            return;
        }
        ProcessHit(damageDealer);
    }
Example #11
0
    private void ProcessHit(DamageDealer damageDealer)
    {
        health -= damageDealer.GetDamage();

        healthBar.sizeDelta = new Vector2((health / maximumHealth) * healthBarSize, healthBar.sizeDelta.y);

        if (health <= 0)
        {
            Die();
        }
    }
Example #12
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     FindObjectOfType <GameSession>().AddToScore(scoreValue);
     if (health <= 0)
     {
         Destroy(gameObject);
         Instantiate(asteroidExplosion, transform.position, Quaternion.identity);
     }
 }
 private void ProcessHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     // TODO: event would be better
     FindObjectOfType <HealthText>().GetComponent <Text>().text = GetHealth().ToString();
     if (health <= 0)
     {
         Die();
     }
 }
Example #14
0
    private void ProcessHit(DamageDealer damageDealer)
    {
        health -= damageDealer.GetDamage();
        damageDealer.Hit();
        FindObjectOfType <LifeDisplay>().LoseLife();

        if (health <= 0)
        {
            Die();
        }
    }
Example #15
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     //GameObject blood = Instantiate(bloodVFX, transform.position, transform.rotation);
     //Destroy(blood, durationOfBlood);
     if (health <= 0)
     {
         Die();
     }
 }
Example #16
0
 private void PlayerHit(DamageDealer damage)
 {
     health -= damage.GetDamage();
     damage.Hit();
     if (health <= 0)
     {
         health = 0;
         FindObjectOfType <Spaceship>().Die(gameObject);
         FindObjectOfType <LevelLoader>().LoadGameOver();
     }
 }
Example #17
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     playerHealth -= damageDealer.GetDamage();
     damageDealer.Hit();
     if (playerHealth <= 0)
     {
         AudioSource.PlayClipAtPoint(deathSFX, Camera.main.transform.position, deathVolume);
         FindObjectOfType <SceneLoader>().LoadGameOverScene();
         Destroy(gameObject);
     }
 }
Example #18
0
    private void SetUpStats()
    {
        player          = FindObjectOfType <Player>();
        myCurrentHealth = player.GetHealth();

        primaryWeapon   = FindObjectOfType <PrimaryWeapon>();
        currentFireRate = primaryWeapon.GetFireRate();

        damage        = FindObjectOfType <DamageDealer>();
        currentDamage = damage.GetDamage();
    }
Example #19
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     FindObjectOfType <HealthDisplay>().RemoveLife();
     HitFX();
     if (health <= 0)
     {
         Die();
     }
 }
    private void RegisterHit(DamageDealer dmgDealer)
    {
        //Reduce Health by Damage Given
        health -= dmgDealer.GetDamage();

        //If Player Health is equal of lower than 0, Player dies
        if (health <= 0)
        {
            Die();
        }
    }
Example #21
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        DamageDealer damageDealer = collision.gameObject.GetComponent <DamageDealer>();

        health -= damageDealer.GetDamage();
        damageDealer.Hit();
        if (health <= 0)
        {
            Destroy(gameObject);
        }
    }
Example #22
0
 private void Damage(Collider2D other, DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     if (health <= 0)
     {
         FindObjectOfType <Level>().LoadGameOver();
         AudioSource.PlayClipAtPoint(deathSoundEffect, Camera.main.transform.position, deathSoundVolume);
         Destroy(gameObject);
     }
 }
Example #23
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     AudioSource.PlayClipAtPoint(hitSounds, Camera.main.transform.position);
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     if (health <= 0)
     {
         health = 0;
         Die();
     }
 }
Example #24
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        DamageDealer damage = other.GetComponent <DamageDealer>();

        PlayerHealth -= damage.GetDamage();
        if (PlayerHealth <= 0)
        {
            Destroy(gameObject);
        }
        Destroy(other.gameObject);
    }
Example #25
0
    private void ProcessHit(DamageDealer damageDealer)
    {
        health -= damageDealer.GetDamage();

        damageDealer.Hit();

        if (health <= 0)
        {
            Die();
        }
    }
Example #26
0
 private void processHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     if (health <= 0)
     {
         EnemyDie();
         //add score
         //Die effect
     }
 }
Example #27
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     if (health <= 0)
     {
         Destroy(gameObject);
         AudioSource.PlayClipAtPoint(playerSounds[1], Camera.main.transform.position, 0.2f);
         FindObjectOfType <SceneLoader>().LoadGameOver();
         Cursor.visible = true;
     }
 }
Example #28
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     // screen shake
     // subtract from healthDisplay
     if (health <= 0)
     {
         Die();
     }
 }
    private void ProcessHit(DamageDealer dmgDealer)
    {
        health -= dmgDealer.GetDamage();

        AudioSource.PlayClipAtPoint(ObstacleDeathSound, Camera.main.transform.position, ObstacleDeathSoundVolume);

        if (health <= 0)
        {
            Destroyed();
        }
    }
Example #30
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     current_health -= damageDealer.GetDamage();
     UnityFunctions.CameraShake();
     damageDealer.Hit();
     if (current_health <= 0)
     {
         current_health = 0;
     }
     this.SendAlert(enum_status.Danger, this.name + " is taking Damage!");
 }