Exemplo n.º 1
0
        public void ApplyMod <E, M>(int uid, IEntityRegistry <E> r, M m) where M : IEntityModifier where E : IEntity, IModifiable <M>
        {
            E e = r.GetEntityByUID(uid);

            m.e = e;
            ApplyMod <M>(m);
        }
Exemplo n.º 2
0
        public void ApplyMod <E, M>(int uid, M m) where M : IEntityModifier where E : IEntity, IModifiable <M>
        {
            IEntityRegistry <E> r = (IEntityRegistry <E>)Registries[typeof(E)];
            E e = r.GetEntityByUID(uid);

            m.e = e;
            ApplyMod <M>(m);
        }
Exemplo n.º 3
0
 public void Query <E, Q>(int uid, IEntityRegistry <E> r, Q q) where Q : IQuery where E : IEntity, IQueriable <Q>
 {
     Query(r.GetEntityByUID(uid), q);
 }
Exemplo n.º 4
0
        //private Func<M, IEvent> GetEntityModFunction<M>(M m) where M : IEntityModifier {
        //    IModifiable<M> e = m.e as IModifiable<M>;
        //    if (e == null)
        //        return null; // Default to the execute method
        //        //throw new Exception(m.e.GetType().Name + " must extend IModifiable<" + typeof(M).Name + "> to be able to use " + m.GetType().Name + " on it.");

        //    // TODO Will not work with empty entity! gettype will return typeof(EmptyEntity), not the intended struct type
        //    // Put bool in registry instead
        //    if (e.GetType().IsValueType) // If the entity is a struct, get the up to date version from the registry first before passing its associated function
        //        m.e = (m.e.Key.Registry as IEntityRegistry).GetUncastEntityByKey(m.e.Key);

        //    return e.ApplyMod;
        //}

        public void Query <E, Q>(int uid, Q q) where Q : IQuery where E : IEntity, IQueriable <Q>
        {
            IEntityRegistry <E> r = (IEntityRegistry <E>)Registries[typeof(E)];

            Query <E, Q>(r.GetEntityByUID(uid), q);
        }