Ejemplo n.º 1
0
 public _ Init(string objType, State rootState, params ILootDef[] defs)
 {
     rootState.Resolve(new Dictionary<string, State>());
     if (defs.Length > 0)
     {
         var loot = new Loot();
         foreach (var i in defs)
             i.Populate(loot, loot);
         rootState.Death += (sender, e) => loot.Handle((Enemy)e.Host, e.Time);
         Definitions.Add(XmlDatas.IdToType[objType], new Tuple<State, Loot>(rootState, loot));
     }
     else
         Definitions.Add(XmlDatas.IdToType[objType], new Tuple<State, Loot>(rootState, null));
     return this;
 }
Ejemplo n.º 2
0
 public ctor Init(string objType, State rootState, params ILootDef[] defs)
 {
     var d = new Dictionary<string, State>();
     rootState.Resolve(d);
     rootState.ResolveChildren(d);
     var dat = InitDb.Manager.GameData;
     if (defs.Length > 0)
     {
         var loot = new Loot(defs);
         rootState.Death += (sender, e) => loot.Handle((Enemy)e.Host, e.Time);
         InitDb.Definitions.Add(dat.IdToObjectType[objType], new Tuple<State, Loot>(rootState, loot));
     }
     else
         InitDb.Definitions.Add(dat.IdToObjectType[objType], new Tuple<State, Loot>(rootState, null));
     return this;
 }
Ejemplo n.º 3
0
 private static State _CommonParent(State current, State a, State b)
 {
     if (b.Is(current)) return current;
     if (a.Parent == null) return null;
     return _CommonParent(current.Parent, a, b);
 }
Ejemplo n.º 4
0
 //child is parent
 //parent is not child
 public bool Is(State state)
 {
     if (this == state) return true;
     if (Parent != null) return Parent.Is(state);
     return false;
 }
Ejemplo n.º 5
0
 public static State CommonParent(State a, State b)
 {
     if (a == null || b == null) return null;
     return _CommonParent(a, a, b);
 }
Ejemplo n.º 6
0
 internal void Resolve(IDictionary<string, State> states)
 {
     TargetState = states[targetStateName];
 }
Ejemplo n.º 7
0
 //child is parent
 //parent is not child
 public bool Is(State state)
 {
     if (this == state) return true;
     else if (this.Parent != null) return this.Parent.Is(state);
     else return false;
 }
Ejemplo n.º 8
0
 protected internal virtual void Resolve(State parent)
 {
 }
Ejemplo n.º 9
0
 protected internal virtual void Resolve(State parent)
 {
 }