/// <summary> /// Cast spell for all targets /// </summary> /// <param name="source"></param> /// <param name="caster"></param> /// <param name="target"></param> public List <ICastResult> InvokeAll(ICastSource source, IEntity caster, IEntity target) { var results = new List <ICastResult>(); if (CanExecuteOnEntity(target)) { _onInvoke.ForEach(element => results.Add(element.Cast(caster, source, target))); } return(results); }
/// <summary> /// Gets castSource for attached property /// </summary> /// <param name="attached"></param> /// <param name="source"></param> /// <param name="caster"></param> /// <param name="target"></param> /// <returns></returns> public static ICastSource GetSource(string attached, ICastSource source, IEntity caster, IEntity target) { var parent = null as ICastSource; switch (attached) { case Src.SOURCE: parent = source; break; case Src.CASTER: parent = caster; break; case Src.HIT: case Src.TARGET: parent = target; break; } return(parent); }
public abstract ICastResult Cast(IEntity caster, ICastSource source, IEntity target);
public static ChannelingCastResult New(ISpellieElement element, IEntity caster, IEntity target, ICastSource src) { // Create new object that represents this result var channelingObject = new GameObject("channelingObject"); // Add ChannelingCastResult to object - it will process channeling events var r = channelingObject.AddComponent <ChannelingCastResult>(); // Setup data and initialize object r.sourceElement = element; r.caster = caster; r.target = target; r.source = src; r.OnChannelStart(); return(r); }
public ICastResult Cast(ICastSource source, IEntity caster, IEntity target) { return(_onSpellCasted?.Cast(caster, source, target)); }