예제 #1
0
 public static void Reset()
 {
     Grimoires.Clear();
     Grimoire.ResetStaticVariables();
     CoroutineEngine.Reset();
     LastResult = false;
 }
예제 #2
0
 private static void ExecuteList(Grimoire grimoire, List <Spell> list)
 {
     for (int j = 0; j < list.Count; j++)
     {
         if (list[j].Enabled)
         {
             LastResult = list[j].Execute(grimoire);
         }
     }
 }
예제 #3
0
 /// <summary>
 /// Add new grimoire
 /// </summary>
 /// <param name="grimoire"></param>
 /// <returns></returns>
 public static bool AddGrimoire(Grimoire grimoire)
 {
     if (grimoire.Name != null && Grimoires.Any(x => x.Name == grimoire.Name))
     {
         return(false);
     }
     else
     {
         Grimoires.Add(grimoire);
         return(true);
     }
 }
예제 #4
0
 /// <summary>
 /// Add new grimoire
 /// </summary>
 /// <param name="grimoire"></param>
 /// <returns></returns>
 public static bool AddGrimoire(Grimoire grimoire)
 {
     if (grimoire.Name != "" && Grimoires.Any(x => x.Name == grimoire.Name))
     {
         //Grimoire name already taken
         return(false);
     }
     else
     {
         //Unnamed grimoire or name is not taken
         Grimoires.Add(grimoire);
         return(true);
     }
 }
예제 #5
0
        //Could use optimization
        public override bool Evaluate(Grimoire grimoire)
        {
            int  ct  = Conditionals.Count;
            bool res = Conditionals[0].Evaluate(grimoire);

            //bypassed if only one
            for (int j = 1; j < ct; j++)
            {
                var next = Conditionals[j - 1].NextOp;
                if (next == QuestionOp.AND)
                {
                    res = res && Conditionals[j].Evaluate(grimoire);
                }
                else if (next == QuestionOp.OR)
                {
                    res = res || Conditionals[j].Evaluate(grimoire);
                }
                else
                {
                    break;
                }
            }
            return(res);
        }
예제 #6
0
 public abstract bool Evaluate(Grimoire grimoire);
예제 #7
0
 //Add param data in subclasses
 public abstract void DoAction(Grimoire grimoire);
예제 #8
0
 public static void RemoveGrimoire(Grimoire g)
 {
     Grimoires.Remove(g);
 }