Exemplo n.º 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;
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 private HpGreaterEqual(int threshold, Behavior result, Behavior no)
 {
     this.threshold = threshold;
     this.result = result;
     this.no = no;
 }
Exemplo n.º 4
0
 private False(Behavior x)
 {
     this.x = x;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 7
0
 public static True Instance(Behavior x)
 {
     True ret;
     if (!instances.TryGetValue(x, out ret))
         ret = instances[x] = new True(x);
     return ret;
 }
Exemplo n.º 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;
 }
Exemplo n.º 9
0
 private IfGreater(int key, int value, Behavior result, Behavior no)
 {
     this.key = key;
     this.value = value;
     this.result = result;
     this.no = no;
 }
Exemplo n.º 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;
 }
Exemplo n.º 11
0
 private IfExist(int key, Behavior result, Behavior no)
 {
     this.key = key;
     this.result = result;
     this.no = no;
 }
Exemplo n.º 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;
 }
Exemplo n.º 13
0
 private If(Behavior cond, Behavior result, Behavior no)
 {
     this.cond = cond;
     this.result = result;
     this.no = no;
 }
Exemplo n.º 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;
 }
Exemplo n.º 15
0
 private HpLesserPercent(float threshold, Behavior result, Behavior no)
 {
     this.threshold = threshold;
     this.result = result;
     this.no = no;
 }
Exemplo n.º 16
0
 public RemoveKey(Behavior behav)
 {
     this.key = behav.Key;
 }
Exemplo n.º 17
0
 private Timed(int time, Behavior behav)
 {
     this.time = time;
     this.behav = behav;
 }
Exemplo n.º 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;
 }
Exemplo n.º 19
0
 private True(Behavior x)
 {
     this.x = x;
 }
Exemplo n.º 20
0
 private IfNot(Behavior cond, Behavior result)
 {
     this.cond = cond;
     this.result = result;
 }
Exemplo n.º 21
0
 private And(Behavior x, Behavior y)
 {
     this.x = x;
     this.y = y;
 }
Exemplo n.º 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;
 }
Exemplo n.º 23
0
 private CooldownExact(int cooldown, Behavior behav)
 {
     this.cooldown = cooldown;
     this.behav = behav;
 }
Exemplo n.º 24
0
 private Not(Behavior x)
 {
     this.x = x;
 }
Exemplo n.º 25
0
 private DamageLesserEqual(int threshold, Behavior result, Behavior no)
 {
     this.threshold = threshold;
     this.result = result;
     this.no = no;
 }
Exemplo n.º 26
0
 public static Not Instance(Behavior x)
 {
     Not ret;
     if (!instances.TryGetValue(x, out ret))
         ret = instances[x] = new Not(x);
     return ret;
 }
Exemplo n.º 27
0
 public static False Instance(Behavior x)
 {
     False ret;
     if (!instances.TryGetValue(x, out ret))
         ret = instances[x] = new False(x);
     return ret;
 }
Exemplo n.º 28
0
 private Once(Behavior x)
 {
     this.x = x;
 }
Exemplo n.º 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;
 }
Exemplo n.º 30
0
 private Or(Behavior x, Behavior y)
 {
     this.x = x;
     this.y = y;
 }