示例#1
0
 //Applies the spells effects when hitting a target
 public void ApplyEffects(ObstructionController enemy)
 {
     IEffectRune[] effects = GetComponents <IEffectRune>();
     for (int i = 0; i < effects.Length; i++)
     {
         effects[i].ApplyEffect(enemy.gameObject, this);
     }
 }
 //determines what the projectile does when it hits a trigger collider
 void OnTriggerEnter(Collider col)
 {
     if (col.tag != "Item")
     {
         ObstructionController other = col.GetComponent <ObstructionController>();
         if (other.player)
         {
             other.GetComponent <PlayerStatController>().DealDamage(damage);
         }
     }
 }
示例#3
0
    //determines what the projectile does when it hits a physics collider
    void OnCollisionEnter(Collision col)
    {
        Collider colider            = col.collider;
        ObstructionController other = colider.GetComponent <ObstructionController>();

        if (other.obstructing)
        {
            Destroy(gameObject);
        }
        else if (other.projectile)
        {
            Physics.IgnoreCollision(colider, this.GetComponent <Collider>());
        }
    }
    //what too do when the projectile hits a non-trigger collider
    void OnCollisionEnter(Collision col)
    {
        Collider colider            = col.collider;
        ObstructionController other = colider.GetComponent <ObstructionController>();

        if (other.obstructing)
        {
            if (rebounding && reboundCount > 0 && other.reboundable)
            {
                reboundCount--;
                Rebound(col);
            }
            else if (ethereal && !other.blockingEthereal)
            {
                Physics.IgnoreCollision(colider, this.GetComponent <Collider>());
                if (etherealTier < 2)
                {
                    evaporating = true;
                }
            }
            else
            {
                DestroyThis();
            }
        }
        else if (other.enemyProjectile)
        {
            if (blocking && blockCount > 0)
            {
                Destroy(other.gameObject);
                blockCount--;
                if (blockCount == 0)
                {
                    DestroyThis();
                }
            }
            else
            {
                Physics.IgnoreCollision(colider, this.GetComponent <Collider>());
            }
        }
        else
        {
            Physics.IgnoreCollision(colider, this.GetComponent <Collider>());
        }
    }
    //what the projectile does when hitting a trigger collider
    void OnTriggerEnter(Collider col)
    {
        if (col.tag != "Item")
        {
            ObstructionController other = col.GetComponent <ObstructionController>();
            if (other.enemy)
            {
                other.GetComponent <EnemyStatController>().ApplyDamage(effectController.GetDamage(other.GetComponent <EnemyStatController>()), effectController.GetDamageType(), effectController.GetCrit(), false);
                other.GetComponent <EnemyController>().ApplyImpact(effectController.GetImpact());
                effectController.ApplyEffects(other);
                if (chaining && chainingTargets > 0)
                {
                    guided      = false;
                    targetFound = false;
                    effectController.ModifyDamage(0.67f);
                    if (FindOtherTarget(other.gameObject) == false)
                    {
                        seeking = true;
                    }
                    else
                    {
                        DestroyThis();
                    }
                }
            }
            else if (other.boss)
            {
                other.GetComponent <BossStatController>().ApplyDamage(effectController.GetDamage(other.GetComponent <BossStatController>()), effectController.GetDamageType(), effectController.GetCrit(), false);
                effectController.ApplyEffects(other.GetComponent <BossStatController>());
                if (chaining && chainingTargets > 0)
                {
                    guided      = false;
                    targetFound = false;
                    effectController.ModifyDamage(0.67f);
                    if (FindOtherTarget(other.gameObject) == false)
                    {
                        seeking = true;
                    }
                    else
                    {
                        DestroyThis();
                    }
                }
            }
            else if (other.minion)
            {
                other.GetComponent <EyerisMinionController>().ApplyDamage(effectController.GetDamage(other.GetComponent <BossStatController>()), effectController.GetDamageType(), effectController.GetCrit(), false);
                effectController.ApplyEffects(other.GetComponent <EyerisMinionController>());
                if (chaining && chainingTargets > 0)
                {
                    guided      = false;
                    targetFound = false;
                    effectController.ModifyDamage(0.67f);
                    if (FindOtherTarget(other.gameObject) == false)
                    {
                        seeking = true;
                    }
                    else
                    {
                        DestroyThis();
                    }
                }
            }

            if (other.obstructing)
            {
                if (piercing && pierceCount > 0 && other.piercable)
                {
                    if (chaining && chainingTargets > 0)
                    {
                        chainingTargets--;
                    }
                    else
                    {
                        pierceCount--;
                        seeking = false;
                    }
                }
                else if (chaining && chainingTargets > 0)
                {
                    chainingTargets--;
                }
                else
                {
                    DestroyThis();
                }
            }
        }
    }