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