public override void applyPassive(Transform player) { ChanceOnHit script = player.gameObject.AddComponent <ChanceOnHit>(); script.init(passiveAction, passiveTriggers, passiveChance); passiveActionID = script.GetInstanceID(); }
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); } }