public CubeGridEntity( MyObjectBuilder_CubeGrid definition ) : base(definition) { _cubeBlockManager = new CubeBlockManager( this ); List<CubeBlockEntity> cubeBlockList = new List<CubeBlockEntity>( ); foreach ( MyObjectBuilder_CubeBlock cubeBlock in definition.CubeBlocks ) { cubeBlock.EntityId = 0; cubeBlockList.Add( new CubeBlockEntity( this, cubeBlock ) ); } _cubeBlockManager.Load( cubeBlockList ); _lastNameRefresh = DateTime.Now; _name = "Cube Grid"; }
public CubeGridEntity(FileInfo prefabFile) : base(BaseObjectManager.LoadContentFile<MyObjectBuilder_CubeGrid, MyObjectBuilder_CubeGridSerializer>(prefabFile)) { ObjectBuilder.EntityId = 0; if(ObjectBuilder.PositionAndOrientation != null) PositionAndOrientation = ObjectBuilder.PositionAndOrientation.GetValueOrDefault(); m_cubeBlockManager = new CubeBlockManager(this); List<CubeBlockEntity> cubeBlockList = new List<CubeBlockEntity>(); foreach (var cubeBlock in ObjectBuilder.CubeBlocks) { cubeBlock.EntityId = 0; cubeBlockList.Add(new CubeBlockEntity(this, cubeBlock)); } m_cubeBlockManager.Load(cubeBlockList); m_lastNameRefresh = DateTime.Now; m_name = "Cube Grid"; }