public PerkScript MakeCopyOnGameObject(GameObject target) { PerkScript script = target.AddComponent(GetType()) as PerkScript; CopyFieldsTo(script); return(script); }
void OnPerkGiven(PerksContainer container) { for (int i = 0; i < perk.perkBehaviors.Length; i++) { perk.perkBehaviors[i].OnPerkGiven(container, perk); } for (int i = 0; i < perk.perkScripts.Length; i++) { PerkScript scriptInstance = perk.perkScripts[i].MakeCopyOnGameObject(container.gameObject); scriptInstance.OnPerkGiven(perk); perkScripts.Add(scriptInstance); } }
protected abstract void CopyFieldsTo(PerkScript target);