public void CreateAbility() { NewAbility = null; NewAbility = new Ability(); NewAbility.abilityID = Guid.NewGuid(); FormRune newForm = ActiveFormRune; NewAbility.aFormRune = newForm.Clone(); NewAbility.aFormRune.rank = int.Parse(FormRuneRank.text); CastModeRune newCast = ActiveCastModeRune; NewAbility.aCastModeRune = newCast.Clone(); NewAbility.aCastModeRune.rank = int.Parse(CastModeRuneRank.text); SchoolRune newSchool = ActiveSchoolRune; NewAbility.aSchoolRune = newSchool.Clone(); NewAbility.aSchoolRune.rank = int.Parse(SchoolRuneRank.text); NewAbility.aEffectRunes = new List <EffectRune>(); if (ActiveEffectRune != null) { EffectRune newEffect = (EffectRune)Activator.CreateInstance(ActiveEffectRune.GetType()); newEffect.rank = int.Parse(EffectRuneRank.text); NewAbility.aEffectRunes.Add(newEffect); } NewAbility.initialized = true; NewAbility.harmful = true; abilitySlot.abilityInSlot = NewAbility; abilitySlot.abilityInSlot.NameSelf(); abilitySlot.slotImage.SetImage(NewAbility); }
public Ability Clone() { Ability temp = new Ability(); temp.abilityID = abilityID; temp.abilityName = abilityName; temp.initialized = initialized; temp.harmful = harmful; temp.helpful = helpful; temp.selfHarm = selfHarm; temp.aFormRune = aFormRune.Clone(); temp.aCastModeRune = aCastModeRune.Clone(); temp.aSchoolRune = aSchoolRune.Clone(); temp.aEffectRunes = new List <EffectRune>(); temp.inspectorEffectRank = inspectorEffectRank; temp.inspectorEffectRuneName = inspectorEffectRuneName; temp.cooldown = cooldown; return(temp); }