예제 #1
0
    // Called first frame that ability is used
    void OnAbilityDown(Weather ability)
    {
        // Particles and sounds
        _spellEffects.UseEffect(ability);
        _playerSounds.PlaySpell(ability);

        AbilityEvent e = CreateAbilityEvent();

        Physics.SyncTransforms(); //not certain if need this, but was recomended to keep track of other objects...
        Collider[] affectedObjects = Physics.OverlapSphere(transform.position, powerRadius);

        for (int i = 0; i < affectedObjects.Length; i++)
        {
            Interactible interactible = affectedObjects[i].GetComponent <Interactible>();
            if (interactible != null)
            {
                interactible.OnAbilityDown(ability, e);
            }
        }
    }