상속: IStateChildren
예제 #1
0
 public static DoMultiple Instance(int doTimes, int cooldown, Behavior behavior)
 {
     var key = new Tuple<int, int, Behavior>(doTimes, cooldown, behavior);
     DoMultiple ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new DoMultiple(doTimes, cooldown, behavior);
     return ret;
 }
예제 #2
0
 public static OrderGroup Instance(float radius, string group, Behavior behav)
 {
     var key = new Tuple<float, string, Behavior>(radius, group, behav);
     OrderGroup ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new OrderGroup(radius, group, behav);
     return ret;
 }
예제 #3
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;
 }
예제 #4
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);
        }
예제 #5
0
 private OrderGroup(float radius, string group, Behavior behav)
 {
     this.radius = radius;
     this.group = group;
     this.behav = behav;
 }
예제 #6
0
 public static IfLesser Instance(int key, int value, Behavior result, Behavior no = null)
 {
     var k = new Tuple<int, int, Behavior, Behavior>(key, value, result, no);
     IfLesser ret;
     if (!instances.TryGetValue(k, out ret))
         ret = instances[k] = new IfLesser(key, value, result, no);
     return ret;
 }
예제 #7
0
 public static IfExist Instance(int key, Behavior result, Behavior no = null)
 {
     var 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;
 }
예제 #8
0
 public static IfNot Instance(Behavior cond, Behavior result)
 {
     var key = new Tuple<Behavior, Behavior>(cond, result);
     IfNot ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new IfNot(cond, result);
     return ret;
 }
예제 #9
0
 public static If Instance(Behavior cond, Behavior result, Behavior no = null)
 {
     var 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;
 }
예제 #10
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;
 }
예제 #11
0
 public static RandomDelay2 Instance(int min, int max, Behavior behav)
 {
     var key = new Tuple<int, int, Behavior>(min, max, behav);
     RandomDelay2 ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new RandomDelay2(min, max, behav);
     return ret;
 }
예제 #12
0
 public static Or Instance(Behavior x, Behavior y)
 {
     var key = Tuple.Create(x, y);
     Or ret;
     if (!instances.TryGetValue(key, out ret))
         ret = instances[key] = new Or(x, y);
     return ret;
 }
예제 #13
0
 private Or(Behavior x, Behavior y)
 {
     this.x = x;
     this.y = y;
 }
예제 #14
0
 private And(Behavior x, Behavior y)
 {
     this.x = x;
     this.y = y;
 }
예제 #15
0
 public DoMultiple(int doTimes, int cooldown, Behavior behavior)
 {
     this.doTimes  = doTimes;
     this.cooldown = cooldown;
     this.behavior = behavior;
 }
예제 #16
0
 public OnDeath(Behavior behav)
 {
     this.behav = behav;
 }
예제 #17
0
 private False(Behavior x)
 {
     this.x = x;
 }
예제 #18
0
 private CooldownExact(int cooldown, Behavior behav)
 {
     this.cooldown = cooldown;
     this.behav = behav;
 }
예제 #19
0
 public static False Instance(Behavior x)
 {
     False ret;
     if (!instances.TryGetValue(x, out ret))
         ret = instances[x] = new False(x);
     return ret;
 }
예제 #20
0
 private If(Behavior cond, Behavior result, Behavior no)
 {
     this.cond = cond;
     this.result = result;
     this.no = no;
 }
예제 #21
0
 private True(Behavior x)
 {
     this.x = x;
 }
예제 #22
0
 private IfNot(Behavior cond, Behavior result)
 {
     this.cond = cond;
     this.result = result;
 }
예제 #23
0
 private Once(Behavior x)
 {
     this.x = x;
 }
예제 #24
0
 private IfExist(int key, Behavior result, Behavior no)
 {
     this.key = key;
     this.result = result;
     this.no = no;
 }
예제 #25
0
 public static Once Instance(Behavior x)
 {
     Once ret;
     if (!instances.TryGetValue(x, out ret))
         ret = instances[x] = new Once(x);
     return ret;
 }
예제 #26
0
 private IfLesser(int key, int value, Behavior result, Behavior no)
 {
     this.key = key;
     this.value = value;
     this.result = result;
     this.no = no;
 }
예제 #27
0
 private Timed(int time, Behavior behav)
 {
     this.time = time;
     this.behav = behav;
 }
예제 #28
0
 private IfBetween(int key, int minValue, int maxValue, Behavior result, Behavior no)
 {
     this.key = key;
     this.minValue = minValue;
     this.maxValue = maxValue;
     this.result = result;
     this.no = no;
 }
예제 #29
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;
 }
예제 #30
0
 private OrderEntity(float radius, short objType, Behavior behav)
 {
     this.radius = radius;
     this.objType = objType;
     this.behav = behav;
 }
예제 #31
0
 public RemoveKey(Behavior behav)
 {
     key = behav.Key;
 }
예제 #32
0
 private RandomDelay2(int min, int max, Behavior behav)
 {
     this.min = min;
     this.max = max;
     this.behav = behav;
 }
예제 #33
0
 public OnHit(Behavior behav)
 {
     this.behav = behav;
 }