private static void StartWave() { //m_meteorList.Add(MyMeteor.SpawnRandomLargeDebug(sphere.Center + sunDir * 500 + MyVRageUtils.GetRandomVector3Normalized() * sphere.Radius, sphere)); var sunDir = MySector.DirectionToSunNormalized; var waveMeteorCount = MyUtils.GetRandomFloat(Math.Min(2, m_meteorcount - 3), m_meteorcount + 3); for (int i = 0; i < waveMeteorCount; i++) { var randCircle = MyUtils.GetRandomVector3CircleNormalized(); var rand = MyUtils.GetRandomFloat(0, 1); Vector3D randomCircleInPlain = randCircle.X * m_rightVector + randCircle.Z * m_downVector; var hitPosition = m_currentTarget.Value.Center + Math.Pow(rand, 0.7f) * m_currentTarget.Value.Radius * randomCircleInPlain; var toSun = sunDir * (2000 + 50 * i); randCircle = MyUtils.GetRandomVector3CircleNormalized(); randomCircleInPlain = randCircle.X * m_rightVector + randCircle.Z * m_downVector; var realPosition = hitPosition + toSun + (float)Math.Tan(MyUtils.GetRandomFloat(0, (float)Math.PI / 18)) * toSun.Length() * randomCircleInPlain; if (MyUtils.GetRandomInt(5) == 0) { m_meteorList.Add(MyMeteor.SpawnRandomLarge(realPosition, Vector3.Normalize(hitPosition - realPosition))); } else { m_meteorList.Add(MyMeteor.SpawnRandomSmall(realPosition, Vector3.Normalize(hitPosition - realPosition))); } } }
private static void StartWave() { if (!m_currentTarget.HasValue) { return; } var sunDir = GetCorrectedDirection(MySector.DirectionToSunNormalized); SetupDirVectors(sunDir); var waveMeteorCount = MyUtils.GetRandomFloat(Math.Min(2, m_meteorcount - 3), m_meteorcount + 3); var randCircle = MyUtils.GetRandomVector3CircleNormalized(); var rand = MyUtils.GetRandomFloat(0, 1); Vector3D randomCircleInPlain = randCircle.X * m_rightVector + randCircle.Z * m_downVector; var hitPosition = m_currentTarget.Value.Center + Math.Pow(rand, 0.7f) * m_currentTarget.Value.Radius * randomCircleInPlain * METEOR_BLUR_KOEF; //Cast Ray for sure var antigravityDir = -Vector3D.Normalize(MyGravityProviderSystem.CalculateNaturalGravityInPoint(hitPosition)); if (antigravityDir != Vector3D.Zero) { var hi = MyPhysics.CastRay(hitPosition + antigravityDir * (3000), hitPosition, MyPhysics.CollisionLayers.DefaultCollisionLayer); if (hi != null) { hitPosition = hi.Value.Position; } } m_meteorHitPos = hitPosition; for (int i = 0; i < waveMeteorCount; i++) { // hit randCircle = MyUtils.GetRandomVector3CircleNormalized(); rand = MyUtils.GetRandomFloat(0, 1); randomCircleInPlain = randCircle.X * m_rightVector + randCircle.Z * m_downVector; hitPosition = hitPosition + Math.Pow(rand, 0.7f) * m_currentTarget.Value.Radius * randomCircleInPlain; // start var toSun = sunDir * (2000 + 100 * i); randCircle = MyUtils.GetRandomVector3CircleNormalized(); randomCircleInPlain = randCircle.X * m_rightVector + randCircle.Z * m_downVector; var realPosition = hitPosition + toSun + (float)Math.Tan(MyUtils.GetRandomFloat(0, (float)Math.PI / 18)) * randomCircleInPlain; m_meteorList.Add(MyMeteor.SpawnRandom(realPosition, Vector3.Normalize(hitPosition - realPosition))); } m_rightVector = Vector3.Zero; }
private static void StartWave() { if (!m_currentTarget.HasValue) { return; } var sunDir = GetCorrectedDirection(MySector.DirectionToSunNormalized); SetupDirVectors(sunDir); var waveMeteorCount = MyUtils.GetRandomFloat(Math.Min(2, m_meteorcount - 3), m_meteorcount + 3); var randCircle = MyUtils.GetRandomVector3CircleNormalized(); var rand = MyUtils.GetRandomFloat(0, 1); Vector3D randomCircleInPlain = randCircle.X * m_rightVector + randCircle.Z * m_downVector; var hitPosition = m_currentTarget.Value.Center + Math.Pow(rand, 0.7f) * m_currentTarget.Value.Radius * randomCircleInPlain * METEOR_BLUR_KOEF; for (int i = 0; i < waveMeteorCount; i++) { // hit randCircle = MyUtils.GetRandomVector3CircleNormalized(); rand = MyUtils.GetRandomFloat(0, 1); randomCircleInPlain = randCircle.X * m_rightVector + randCircle.Z * m_downVector; hitPosition = hitPosition + Math.Pow(rand, 0.7f) * m_currentTarget.Value.Radius * randomCircleInPlain; // start var toSun = sunDir * (2000 + 100 * i); randCircle = MyUtils.GetRandomVector3CircleNormalized(); randomCircleInPlain = randCircle.X * m_rightVector + randCircle.Z * m_downVector; var realPosition = hitPosition + toSun + (float)Math.Tan(MyUtils.GetRandomFloat(0, (float)Math.PI / 18)) * randomCircleInPlain; m_meteorList.Add(MyMeteor.SpawnRandom(realPosition, Vector3.Normalize(hitPosition - realPosition))); } m_rightVector = Vector3.Zero; }