/// <summary> /// This creates random size in random location /// TODO: Look at existing sizes more carefully to see what size to create /// TODO: Don't create something near the player - take a list of spheres to avoid (or maybe cubes) /// TODO: Have certain features of the map be sources - maybe a couple hidden moving sources that slowly move around the edge of the map /// TODO: When creating asteroids, create a small stream of them /// </summary> private static ChangeInstruction[] ExamineAsteroids_Add1(int count, Boundry boundry) { ChangeInstruction[] retVal = new ChangeInstruction[count]; for (int cntr = 0; cntr < count; cntr++) { //asteroidSize = 4 + (rand.NextDouble() * 6); // medium //asteroidSize = 9 + (rand.NextDouble() * 10); // large double asteroidSize = 4 + StaticRandom.NextDouble(16); Point3D position = Math3D.GetRandomVector(boundry.Outer_Min, boundry.Outer_Max, boundry.Inner_Min, boundry.Inner_Max).ToPoint(); Vector3D velocity = Math3D.GetRandomVector_Circular(6d); Vector3D angVel = Math3D.GetRandomVector_Spherical(1d); AsteroidDNA asteroid = new AsteroidDNA() { PartType = Asteroid.PARTTYPE, Radius = asteroidSize, Position = position, //NOTE: These are duplication and aren't used, but storing them anyway Velocity = velocity, AngularVelocity = angVel, }; retVal[cntr] = new ChangeInstruction(position, velocity, angVel, asteroid); } return(retVal); }
private void AddMineral(ChangeInstruction instr) { Mineral mineral = new Mineral(instr.Mineral.MineralType, instr.Add_Position, instr.Mineral.Volume, _world, _material_Mineral, _sharedVisuals, ItemOptionsAstMin2D.MINERAL_DENSITYMULT, instr.Mineral.Volume / ItemOptionsAstMin2D.MINERAL_AVGVOLUME); mineral.PhysicsBody.AngularVelocity = instr.Add_AngVel; mineral.PhysicsBody.Velocity = instr.Add_Velocity; _map.AddItem(mineral); }
private void AddAsteroid(ChangeInstruction instr) { //NOTE: The dna only holds radius, no triangles AsteroidExtra extra = new AsteroidExtra() { GetMineralsByDestroyedMass = _getMineralsByDestroyedMass, MineralMaterialID = _material_Mineral, MinChildRadius = _minChildAsteroidRadius, }; Asteroid asteroid = new Asteroid(instr.Asteroid.Radius, _getAsteroidMassByRadius, instr.Add_Position, _world, _map, _material_Asteroid, extra); asteroid.PhysicsBody.AngularVelocity = instr.Add_AngVel; asteroid.PhysicsBody.Velocity = instr.Add_Velocity; _map.AddItem(asteroid); }
/// <summary> /// This creates random size in random location /// TODO: Look at existing sizes more carefully to see what size to create /// TODO: Don't create something near the player - take a list of spheres to avoid (or maybe cubes) /// TODO: Have certain features of the map be sources - maybe a couple hidden moving sources that slowly move around the edge of the map /// TODO: When creating asteroids, create a small stream of them /// </summary> private static ChangeInstruction[] ExamineAsteroids_Add1(int count, Boundry boundry) { ChangeInstruction[] retVal = new ChangeInstruction[count]; for (int cntr = 0; cntr < count; cntr++) { //asteroidSize = 4 + (rand.NextDouble() * 6); // medium //asteroidSize = 9 + (rand.NextDouble() * 10); // large double asteroidSize = 4 + StaticRandom.NextDouble(16); Point3D position = Math3D.GetRandomVector(boundry.Outer_Min, boundry.Outer_Max, boundry.Inner_Min, boundry.Inner_Max).ToPoint(); Vector3D velocity = Math3D.GetRandomVector_Circular(6d); Vector3D angVel = Math3D.GetRandomVector_Spherical(1d); AsteroidDNA asteroid = new AsteroidDNA() { PartType = Asteroid.PARTTYPE, Radius = asteroidSize, Position = position, //NOTE: These are duplication and aren't used, but storing them anyway Velocity = velocity, AngularVelocity = angVel, }; retVal[cntr] = new ChangeInstruction(position, velocity, angVel, asteroid); } return retVal; }