Beispiel #1
0
    // Called every frame (except first and last) that ability is used
    void OnAbility(Weather 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.OnAbility(ability, e);
            }
        }
    }