public static void LoadInDraw() { MyMwcLog.WriteLine("MyMeteorWind.LoadInDraw() - START"); MyMwcLog.IncreaseIndent(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyMeteorWind::LoadInDraw"); List <MyMwcObjectBuilder_StaticAsteroid_TypesEnum> asteroids = new List <MyMwcObjectBuilder_StaticAsteroid_TypesEnum>(); List <int> sizes = new List <int>(); foreach (int size in MyMwcObjectBuilder_StaticAsteroid.AsteroidSizes) { if (size >= minSize && size <= maxSize) { sizes.Add(size); } } foreach (int size in sizes) { MyMwcObjectBuilder_Meteor.GetAsteroids(size, MyStaticAsteroidTypeSetEnum.A, asteroids); } foreach (var asteroid in asteroids) { MyStaticAsteroid.MyStaticAsteroidModels models = MyMeteor.GetModelsFromType(asteroid); PreloadModels(models); } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyMeteorWind.LoadInDraw() - END"); }
public static MyMeteor GenerateMeteor(float sizeInMeters, Matrix worldMatrix, Vector3 position, MyMwcVoxelMaterialsEnum material) { int size = MySectorGenerator.FindAsteroidSize(sizeInMeters, MyMwcObjectBuilder_StaticAsteroid.AsteroidSizes); asteroids.Clear(); MyMwcObjectBuilder_Meteor.GetAsteroids(size, MyStaticAsteroidTypeSetEnum.A, asteroids); int rndIndex = MyMwcUtils.GetRandomInt(0, asteroids.Count); var builder = new MyMwcObjectBuilder_Meteor(asteroids[rndIndex], material); builder.PositionAndOrientation.Position = position; builder.PositionAndOrientation.Forward = MyMwcUtils.GetRandomVector3Normalized(); builder.PositionAndOrientation.Up = MyMwcUtils.GetRandomVector3Normalized(); builder.UseModelTechnique = false; MyMeteor meteor = (MyMeteor)MyEntities.CreateFromObjectBuilderAndAdd(null, builder, worldMatrix); meteor.m_size = sizeInMeters; return(meteor); }