Example #1
0
 public void ResolveBehavior(Entity entity)
 {
     if (Definitions.TryGetValue(entity.ObjectType, out Tuple <State, Loot> def))
     {
         entity.SwitchTo(def.Item1);
     }
 }
Example #2
0
        public bool Tick(Entity host, RealmTime time)
        {
            object state;

            if (!host.StateStorage.TryGetValue(this, out state))
            {
                state = null;
            }

            bool 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 #3
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 #4
0
        public bool Tick(Entity host, RealmTime time)
        {
            host.StateStorage.TryGetValue(this, out var state);

            var ret = TickCore(host, time, ref state);

            if (ret)
            {
                host.SwitchTo(TargetState[SelectedState]);
            }

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