예제 #1
0
        public SectorEntity(MyObjectBuilder_Sector definition)
            : base(definition)
        {
            m_eventManager          = new BaseObjectManager();
            m_cubeGridManager       = new BaseObjectManager();
            m_voxelMapManager       = new BaseObjectManager();
            m_floatingObjectManager = new BaseObjectManager();
            m_meteorManager         = new BaseObjectManager();

            List <Event> events = new List <Event>();

            foreach (var sectorEvent in definition.SectorEvents.Events)
            {
                events.Add(new Event(sectorEvent));
            }

            List <CubeGridEntity> cubeGrids       = new List <CubeGridEntity>();
            List <VoxelMap>       voxelMaps       = new List <VoxelMap>();
            List <FloatingObject> floatingObjects = new List <FloatingObject>();
            List <Meteor>         meteors         = new List <Meteor>();

            foreach (var sectorObject in definition.SectorObjects)
            {
                if (sectorObject.TypeId == typeof(MyObjectBuilder_CubeGrid))
                {
                    cubeGrids.Add(new CubeGridEntity((MyObjectBuilder_CubeGrid)sectorObject));
                }
                else if (sectorObject.TypeId == typeof(MyObjectBuilder_VoxelMap))
                {
                    voxelMaps.Add(new VoxelMap((MyObjectBuilder_VoxelMap)sectorObject));
                }
                else if (sectorObject.TypeId == typeof(MyObjectBuilder_FloatingObject))
                {
                    floatingObjects.Add(new FloatingObject((MyObjectBuilder_FloatingObject)sectorObject));
                }
                else if (sectorObject.TypeId == typeof(MyObjectBuilder_Meteor))
                {
                    meteors.Add(new Meteor((MyObjectBuilder_Meteor)sectorObject));
                }
            }

            //Build the managers from the lists
            m_eventManager.Load(events);
            m_cubeGridManager.Load(cubeGrids);
            m_voxelMapManager.Load(voxelMaps);
            m_floatingObjectManager.Load(floatingObjects);
            m_meteorManager.Load(meteors);
        }
예제 #2
0
 public override void Export(FileInfo fileInfo)
 {
     BaseObjectManager.SaveContentFile <MyObjectBuilder_EntityBase, MyObjectBuilder_EntityBaseSerializer>(ObjectBuilder, fileInfo);
 }
예제 #3
0
 public virtual void Export(FileInfo fileInfo)
 {
     BaseObjectManager.SaveContentFile <MyObjectBuilder_Base, MyObjectBuilder_BaseSerializer>(ObjectBuilder, fileInfo);
 }