Exemplo n.º 1
0
        public EventManager.EventResult handleDependancy(Event e)
        {
            AttributeChangedEvent <UInt64> em = e as AttributeChangedEvent <UInt64>;

            if (em != null && em.attributeId == Attributes.Parent)
            {
                Entity ent    = myDatabase.findEntity(em.entity);
                Entity parent = myDatabase.findEntity(em.value);

                placeEntity(ent, parent);
            }

            return(EventManager.EventResult.HANDLED);
        }
Exemplo n.º 2
0
        public EventManager.EventResult handleAttributeUpdate(Event e)
        {
            AttributeChangedEvent <Vector3> em = e as AttributeChangedEvent <Vector3>;

            if (em != null && em.attributeId == Attributes.Position)
            {
                //is this an entity we are tracking
                OctreeElement <Entity> el;
                if (theOctreeEntityMap.TryGetValue(em.entity, out el))
                {
                    if (convertPosition(ref el, em.value) == true)
                    {
                        theOctree.update(el);
                    }
                    return(EventManager.EventResult.HANDLED);
                }
            }

            return(EventManager.EventResult.IGNORED);
        }
Exemplo n.º 3
0
        public EventManager.EventResult handleAttributeChange(Event e)
        {
            AttributeChangedEvent <bool> ac = e as AttributeChangedEvent <bool>;

            if (ac != null && ac.attributeId == Attributes.Dynamic)
            {
                Entity ent = myDatabase.findEntity(ac.entity);
                if (ac.value == true)
                {
                    myEntities.Add(ent);
                }
                else
                {
                    myEntities.Remove(ent);
                }

                return(EventManager.EventResult.HANDLED);
            }

            return(EventManager.EventResult.IGNORED);
        }
Exemplo n.º 4
0
        public void notifyUpdate(T newVal)
        {
            AttributeChangedEvent <T> ce = new AttributeChangedEvent <T>(myState.entity.id, myName, newVal);

            Application.eventManager.queueEvent(ce);
        }