Esempio n. 1
0
        //---------------------------------------------------------------------
        public EntityMgr(byte node_type, string nodetype_string)
        {
            mEntityMgr       = this;
            NodeType         = node_type;
            NodeTypeAsString = nodetype_string;

            mEntityEventPublisherDefault = new EntityEventPublisher(this);
        }
Esempio n. 2
0
        //---------------------------------------------------------------------
        public void _reset(EntityData entity_data)
        {
            SignDestroy   = false;
            Type          = entity_data.entity_type;
            Guid          = entity_data.entity_guid;
            mMapCacheData = entity_data.cache_data;

            mPublisher = new EntityEventPublisher(EntityMgr);
            mPublisher.addHandler(this);

            EntityDef entity_def = EntityMgr.getEntityDef(entity_data.entity_type);

            if (entity_def == null)
            {
                return;
            }

            foreach (var i in entity_def.ListComponentDef)
            {
                IComponentFactory component_factory = EntityMgr.getComponentFactory(i);
                if (component_factory == null)
                {
                    EbLog.Error("Entity.addComponent() failed! can't find component_factory, component=" + i);
                    continue;
                }

                Dictionary <string, string> def_propset = null;
                if (entity_data.map_component != null)
                {
                    entity_data.map_component.TryGetValue(i, out def_propset);
                }

                var component = component_factory.createComponent(this, def_propset);
                mMapComponent[i] = component;
                mListComponent.Add(component);
                component.awake();
            }
        }
Esempio n. 3
0
 //---------------------------------------------------------------------
 public EbGridRegion(EntityMgr entity_mgr)
 {
     Publisher = new EntityEventPublisher(entity_mgr);
     SetEntity = new HashSet <Entity>();
 }