Пример #1
0
    // Will trigger the effects in the AIBehaviour Script
    private void UseEffect(AIBehaviour ai, ElementEffect effect)
    {
        if (effect == null)
        {
            return;
        }

        if (effect.willDamage)
        {
            ai.Damage(effect.damage);
        }

        if (effect.willPush)
        {
            Vector3 offset = transform.position - ai.transform.position;
            ai.Push(Mathf.Sign(offset.x), effect.pushForce);
        }

        if (effect.willFreeze)
        {
            ai.Freeze(effect.activeTime);
        }

        if (effect.willStun)
        {
            ai.Stun(effect.activeTime);
        }
    }