void Awake() { if (Self == null) { Self = this; } MustHaveTarget = (spell, caster, target) => caster.Target != null; MustRespectGlobalCooldown = (spell, caster, target) => caster.GlobalCooldownRemaining <= 0; CantCastWhileCasting = (spell, caster, target) => caster.State != State.casting; DefaultSpellRuleCheck = new List <RuleCheck> { MustHaveTarget, //(spell, caster, target) => spell.manaCost <= caster.mana, (spell, caster, target) => (target.transform.position - caster.transform.position).magnitude < spell.Range.Get(), //(spell, caster, target) => caster.velocity == Vector3.zero, (spell, caster, target) => spell.Ammo.GetVal() > 0, (spell, caster, target) => spell.IsReady(), //MustRespectGlobalCooldown, CantCastWhileCasting }; }
public static HashMap <int, List <HtmlInputText> > RuleCompile(HashMap <int, List <HtmlInputText> > data, RuleCheck rule, bool isFullDay, List <HtmlInputText> distinctElements) { switch (rule) { case RuleCheck.OneHalfDayShift: return(RuleZero(data, isFullDay, distinctElements)); case RuleCheck.NoTwoNoonShift: return(RuleOne(data, isFullDay, distinctElements)); case RuleCheck.OneDayInTwoWeeks: return(RuleTwo(data, isFullDay, distinctElements)); case RuleCheck.TwoDaysExemption: break; } return(data); }