public Ability(SerializationInfo info, StreamingContext context) { name = info.GetString("name"); desc = info.GetString("desc"); iconPath = info.GetString("iconPath"); icon = Resources.Load <Sprite>(iconPath); cooldownMax = info.GetSingle("cooldownMax"); _cooldownCurr = info.GetSingle("cooldownCurr"); effectName = info.GetString("effect"); effect = (UseEffect)Delegate.CreateDelegate( typeof(UseEffect), this, typeof(Ability).GetMethod(effectName, BindingFlags.NonPublic | BindingFlags.Instance)); checkName = info.GetString("prereq"); if (checkName != "") { check = (PrereqCheck)Delegate.CreateDelegate( typeof(PrereqCheck), this, typeof(Ability).GetMethod(checkName, BindingFlags.NonPublic | BindingFlags.Instance)); } else { check = null; } preAnim = info.GetString("preAnim"); postAnim = info.GetString("postAnim"); available = info.GetBoolean("available"); active = info.GetBoolean("active"); }
private Ability(string name, string desc, string iconPath, float cooldownMax, int chargesMax, string effect, string prereq = "", string preAnim = "", string postAnim = "") { this.id = -1; this.name = name; this.desc = desc; this.iconPath = iconPath; if (iconPath != "") { icon = ABU.LoadAsset <Sprite> (ICON_DIR, iconPath); } else { icon = null; } this.CooldownMax = cooldownMax; _cooldownCurr = cooldownMax; this.ChargesMax = chargesMax; _charges = 0; effectName = effect; this.effect = (UseEffect)Delegate.CreateDelegate( typeof(UseEffect), this, typeof(Ability).GetMethod(effectName, BindingFlags.NonPublic | BindingFlags.Instance)); checkName = prereq; if (checkName != "") { check = (PrereqCheck)Delegate.CreateDelegate( typeof(PrereqCheck), this, typeof(Ability).GetMethod(checkName, BindingFlags.NonPublic | BindingFlags.Instance)); } else { check = null; } this.preAnim = preAnim; this.postAnim = postAnim; Active = false; Available = true; persData = null; }
public Ability(string name, string desc, Sprite icon, float cooldownMax, int chargesMax, UseEffect effect) { this._id = -1; this.name = name; this.desc = desc; this.icon = icon; this.cooldownMax = cooldownMax; _cooldownCurrent = cooldownMax; this.chargesMax = chargesMax; _charges = 0; this.effect = effect; active = false; available = true; persistentData = null; }
/* Constructors */ public Ability(string name, string desc, string iconPath, float cooldownMax, string effect, string prereq = "", string preAnim = "", string postAnim = "") { this.name = name; this.desc = desc; this.iconPath = iconPath; if (iconPath != "") { icon = Resources.Load <Sprite> (iconPath); } else { icon = null; } this.cooldownMax = cooldownMax; _cooldownCurr = cooldownMax; effectName = effect; this.effect = (UseEffect)Delegate.CreateDelegate( typeof(UseEffect), this, typeof(Ability).GetMethod(effectName, BindingFlags.NonPublic | BindingFlags.Instance)); checkName = prereq; if (checkName != "") { check = (PrereqCheck)Delegate.CreateDelegate( typeof(PrereqCheck), this, typeof(Ability).GetMethod(checkName, BindingFlags.NonPublic | BindingFlags.Instance)); } else { check = null; } this.preAnim = preAnim; this.postAnim = postAnim; active = false; available = true; }
public Ability(SerializationInfo info, StreamingContext context) { id = info.GetInt32("id"); name = info.GetString("name"); desc = info.GetString("desc"); iconPath = info.GetString("iconPath"); icon = ABU.LoadAsset <Sprite> (ICON_DIR, iconPath); CooldownMax = info.GetSingle("cooldownMax"); _cooldownCurr = info.GetSingle("cooldownCurr"); ChargesMax = info.GetInt32("chargesMax"); _charges = info.GetInt32("charges"); effectName = info.GetString("effect"); effect = (UseEffect)Delegate.CreateDelegate( typeof(UseEffect), this, typeof(Ability).GetMethod(effectName, BindingFlags.NonPublic | BindingFlags.Instance)); checkName = info.GetString("prereq"); if (checkName != "") { check = (PrereqCheck)Delegate.CreateDelegate( typeof(PrereqCheck), this, typeof(Ability).GetMethod(checkName, BindingFlags.NonPublic | BindingFlags.Instance)); } else { check = null; } preAnim = info.GetString("preAnim"); postAnim = info.GetString("postAnim"); Available = info.GetBoolean("available"); Active = info.GetBoolean("active"); persData = (ISerializable)info.GetValue("persData", typeof(ISerializable)); }