Example #1
0
        public bool Tick(Entity host, RealmTime time)
        {
            object state;
            if (!host.StateStorage.TryGetValue(this, out state))
                state = null;

            var ret = TickCore(host, time, ref state);
            if (ret)
                host.SwitchTo(TargetState);

            if (state == null)
                host.StateStorage.Remove(this);
            else
                host.StateStorage[this] = state;
            return ret;
        }
Example #2
0
 public static void ResolveBehavior(Entity entity)
 {
     Tuple<State, Loot> def;
     if (Definitions.TryGetValue(entity.ObjectType, out def))
         entity.SwitchTo(def.Item1);
 }