예제 #1
0
    public override void applyPassive(Transform player)
    {
        ChanceOnHit script = player.gameObject.AddComponent <ChanceOnHit>();

        script.init(passiveAction, passiveTriggers, passiveChance);
        passiveActionID = script.GetInstanceID();
    }
예제 #2
0
    public override void undoPassive(Transform player)
    {
        ChanceOnHit[] actions = player.gameObject.GetComponents <ChanceOnHit>();
        ChanceOnHit   action  = null;

        foreach (ChanceOnHit a in actions)
        {
            if (a.GetInstanceID() == passiveActionID)
            {
                action = a;
            }
        }
        if (action)
        {
            Destroy(action);
        }
    }