コード例 #1
0
    public void CheckToEffectOnInteractiveObjects()
    {
        Collider[] colliders = Physics.OverlapSphere(ratApexDynaController.gameObject.transform.position, explosionRange, layerMask);
        length = colliders.Length;

        if (length > 0)
        {
            for (i = 0; i < length; i++)
            {
                ISimpleInteractive simple = colliders[i].gameObject.GetComponentInParent <ISimpleInteractive>();
                if (simple != null)
                {
                    if (simple.GetPosition() != ratApexDynaController.gameObject.transform.position) //not react on own body
                    {
                        simple.ExplosionHit(explosionForce, ratApexDynaController.gameObject.transform.position, explosionRange, explosionMaxHit);
                    }
                }
                else
                {
                    DamageController playerDamageController = colliders[i].gameObject.GetComponent <DamageController>();
                    if (playerDamageController != null)
                    {
                        playerDamageController.TakeExplosionHit(explosionMaxHit, ratApexDynaController.gameObject.transform.position);
                    }
                }
            }
        }
    }