Beispiel #1
0
    private void AttemptApplyEffect(Unit target, UnitEffect effect)
    {
        //Make copy
        UnitEffect copy = MakeCopy(effect, target);

        MDebug.Log("^effectsAttempt Apply \n" + copy.ToString() + "  by " + copy.Instigator);

        if (CanApplyEffect(target, copy) && target.GetComponent <Unit_EffectManager>().ApplyEffect(copy))
        {
            TurnSystem.Instance.OnGlobalTurn += copy.OnGlobalTurn;

            if (VFX_Applied != null)
            {
                VFX_Applied.Init(target.currentTile.gameObject);
            }


            if (TickOnApply)
            {
                copy.EffectTick();
            }
        }
        else
        {
            Destroy(copy.gameObject);
        }
    }