Exemplo n.º 1
0
    /// <summary>
    /// Dealing damage if other of player
    /// </summary>
    /// <param name="other">An Enemy</param>
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <BlueBullet>() || other.CompareTag("Player"))
        {
            return;
        }

        //OnHitParticleSystem(); Same, not created yet

        if (other.GetComponent <BlueEnemy>())
        {
            BlueEnemy target = other.GetComponent <BlueEnemy>();
            target.TakeDamage(damage, this.type);
        }

        Destroy(gameObject);
    }
Exemplo n.º 2
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("RedEnemy"))
        {
            RedEnemy enemy = other.GetComponentInParent <RedEnemy>();
            enemy.TakeDamage(DamageQuantity(other), "explosion");
        }
        if (other.CompareTag("BlueEnemy"))
        {
            BlueEnemy enemy = other.GetComponentInParent <BlueEnemy>();
            enemy.TakeDamage(DamageQuantity(other), "explosion");
        }
        if (other.CompareTag("Player"))
        {
            PlayerHealth player = other.GetComponentInParent <PlayerHealth>();
            player.TakeDamage(DamageQuantity(other));
        }

        PushBack(other);
        ExplosionEnd();
    }