Пример #1
0
    private void OnTriggerEnter(Collider other)
    {
        WadeMachine wade = other.GetComponent <WadeMachine>();

        if (wade != null)
        {
            wade.DoTakeDamage(hitPower);
        }
        print("dfdfs");
    }
    private void OnTriggerEnter(Collider other)
    {
        Enemy              enemy  = other.gameObject.GetComponent <Enemy>();
        WadeMachine        wade   = other.gameObject.GetComponent <WadeMachine>();
        WadeBoatController boat   = other.gameObject.GetComponent <WadeBoatController>();
        BulletStandard     bullet = other.gameObject.GetComponent <BulletStandard>();
        Slash              slash  = other.gameObject.GetComponent <Slash>();
        AudioTrigger       mt     = other.gameObject.GetComponent <AudioTrigger>();

        if (!slash)
        {
            if (wade)
            {
                if (!wadesBullet)
                {
                    wade.DoTakeDamage(damage);
                    Instantiate(explosionEffect, transform.position, transform.rotation);
                    Destroy(gameObject);
                }
            }

            if (enemy)
            {
                if (wadesBullet)
                {
                    enemy.DoTakeDamage(damage);
                    Instantiate(explosionEffect, transform.position, transform.rotation);
                    Destroy(gameObject);
                }
            }


            if (!wade && !bullet && !boat && !mt)
            {
                if (other.gameObject.name != "BoatTrigger" && other.gameObject.name != "Mover")
                {
                    Instantiate(explosionEffect, transform.position, transform.rotation);
                    Destroy(gameObject);
                }
            }
        }
    }
Пример #3
0
    void Explode()
    {
        Instantiate(explosionEffect, transform.position, transform.rotation);
        Collider[] colliders = Physics.OverlapSphere(transform.position, blastRadius);

        foreach (Collider nearbyObject in colliders)
        {
            Enemy       enemy = nearbyObject.GetComponent <Enemy>();
            WadeMachine wade  = nearbyObject.GetComponent <WadeMachine>();
            if (enemy != null)
            {
                if (!enemyGrenade)
                {
                    enemy.DoTakeDamage(damage);
                }
            }

            if (wade != null)
            {
                wade.DoTakeDamage(damage);
            }
        }
        Destroy(gameObject);
    }