Example #1
0
 public static OrderEntity Instance(float radius, short objType, Behavior behav)
 {
     var key = new Tuple<float, short, Behavior>(radius, objType, behav);
     OrderEntity ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new OrderEntity(radius, objType, behav);
     return ret;
 }
Example #2
0
        //Candies
        static BehaviorDef Behaves(
            string name,
            Behavior movement = null,
            Behavior attack = null,
            Behavior reproduce = null,
            LootBehavior loot = null,
            params ConditionalBehavior[] condBehaviors)
        {
            if (loot != null)
            {
                Array.Resize(ref condBehaviors, condBehaviors.Length + 1);
                condBehaviors[condBehaviors.Length - 1] = loot;
            }

            return new BehaviorDef(
                movement ?? NullBehavior.Instance,
                attack ?? NullBehavior.Instance,
                reproduce ?? NullBehavior.Instance,
                condBehaviors);
        }
Example #3
0
 private HpGreaterEqual(int threshold, Behavior result, Behavior no)
 {
     this.threshold = threshold;
     this.result = result;
     this.no = no;
 }
Example #4
0
 private False(Behavior x)
 {
     this.x = x;
 }
Example #5
0
 public static CooldownExact Instance(int cooldown, Behavior behav = null)
 {
     var key = new Tuple<int, Behavior>(cooldown, behav);
     CooldownExact ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new CooldownExact(cooldown, behav);
     return ret;
 }
Example #6
0
 public static And Instance(Behavior x, Behavior y)
 {
     var key = Tuple.Create(x, y);
     And ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new And(x, y);
     return ret;
 }
Example #7
0
 public static True Instance(Behavior x)
 {
     True ret;
     if (!instances.TryGetValue(x, out ret))
         ret = instances[x] = new True(x);
     return ret;
 }
Example #8
0
 public static Timed Instance(int time, Behavior behav)
 {
     var key = new Tuple<int, Behavior>(time, behav);
     Timed ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new Timed(time, behav);
     return ret;
 }
Example #9
0
 private IfGreater(int key, int value, Behavior result, Behavior no)
 {
     this.key = key;
     this.value = value;
     this.result = result;
     this.no = no;
 }
Example #10
0
 public static IfExist Instance(int key, Behavior result, Behavior no = null)
 {
     Tuple<int, Behavior, Behavior> k = new Tuple<int, Behavior, Behavior>(key, result, no);
     IfExist ret;
     if (!instances.TryGetValue(k, out ret))
         ret = instances[k] = new IfExist(key, result, no);
     return ret;
 }
Example #11
0
 private IfExist(int key, Behavior result, Behavior no)
 {
     this.key = key;
     this.result = result;
     this.no = no;
 }
Example #12
0
 public static If Instance(Behavior cond, Behavior result, Behavior no = null)
 {
     Tuple<Behavior, Behavior, Behavior> key = new Tuple<Behavior, Behavior, Behavior>(cond, result, no);
     If ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new If(cond, result, no);
     return ret;
 }
Example #13
0
 private If(Behavior cond, Behavior result, Behavior no)
 {
     this.cond = cond;
     this.result = result;
     this.no = no;
 }
Example #14
0
 public static HpLesserPercent Instance(float threshold, Behavior result, Behavior no = null)
 {
     Tuple<float, Behavior, Behavior> k = new Tuple<float, Behavior, Behavior>(threshold, result, no);
     HpLesserPercent ret;
     if (!instances.TryGetValue(k, out ret))
         ret = instances[k] = new HpLesserPercent(threshold, result, no);
     return ret;
 }
Example #15
0
 private HpLesserPercent(float threshold, Behavior result, Behavior no)
 {
     this.threshold = threshold;
     this.result = result;
     this.no = no;
 }
Example #16
0
 public RemoveKey(Behavior behav)
 {
     this.key = behav.Key;
 }
Example #17
0
 private Timed(int time, Behavior behav)
 {
     this.time = time;
     this.behav = behav;
 }
Example #18
0
 public static IfGreater Instance(int key, int value, Behavior result, Behavior no = null)
 {
     Tuple<int, int, Behavior, Behavior> k = new Tuple<int, int, Behavior, Behavior>(key, value, result, no);
     IfGreater ret;
     if (!instances.TryGetValue(k, out ret))
         ret = instances[k] = new IfGreater(key, value, result, no);
     return ret;
 }
Example #19
0
 private True(Behavior x)
 {
     this.x = x;
 }
Example #20
0
 private IfNot(Behavior cond, Behavior result)
 {
     this.cond = cond;
     this.result = result;
 }
Example #21
0
 private And(Behavior x, Behavior y)
 {
     this.x = x;
     this.y = y;
 }
Example #22
0
 public static IfNot Instance(Behavior cond, Behavior result)
 {
     Tuple<Behavior, Behavior> key = new Tuple<Behavior, Behavior>(cond, result);
     IfNot ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new IfNot(cond, result);
     return ret;
 }
Example #23
0
 private CooldownExact(int cooldown, Behavior behav)
 {
     this.cooldown = cooldown;
     this.behav = behav;
 }
Example #24
0
 private Not(Behavior x)
 {
     this.x = x;
 }
Example #25
0
 private DamageLesserEqual(int threshold, Behavior result, Behavior no)
 {
     this.threshold = threshold;
     this.result = result;
     this.no = no;
 }
Example #26
0
 public static Not Instance(Behavior x)
 {
     Not ret;
     if (!instances.TryGetValue(x, out ret))
         ret = instances[x] = new Not(x);
     return ret;
 }
Example #27
0
 public static False Instance(Behavior x)
 {
     False ret;
     if (!instances.TryGetValue(x, out ret))
         ret = instances[x] = new False(x);
     return ret;
 }
Example #28
0
 private Once(Behavior x)
 {
     this.x = x;
 }
Example #29
0
 public static HpGreaterEqual Instance(int threshold, Behavior result, Behavior no = null)
 {
     Tuple<int, Behavior, Behavior> k = new Tuple<int, Behavior, Behavior>(threshold, result, no);
     HpGreaterEqual ret;
     if (!instances.TryGetValue(k, out ret))
         ret = instances[k] = new HpGreaterEqual(threshold, result, no);
     return ret;
 }
Example #30
0
 private Or(Behavior x, Behavior y)
 {
     this.x = x;
     this.y = y;
 }