コード例 #1
0
        //---------------------------------------------------------------------
        public EntityMgr(byte node_type, string nodetype_string)
        {
            mEntityMgr = this;
            NodeType = node_type;
            NodeTypeAsString = nodetype_string;

            mEntityEventPublisherDefault = new EntityEventPublisher(this);
        }
コード例 #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.list_component != null)
                {
                    foreach (var j in entity_data.list_component)
                    {
                        if (j.component_name == i)
                        {
                            def_propset = j.def_propset;
                            break;
                        }
                    }
                }

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