using QSB.WorldSync; using UnityEngine; namespace QSB.MeteorSync.WorldObjects; public class QSBMeteorLauncher : WorldObject { public void PreLaunchMeteor() { foreach (var launchParticle in AttachedObject._launchParticles) { launchParticle.Play(); } } public void LaunchMeteor(MeteorController meteor, float launchSpeed) { meteor.Initialize(AttachedObject.transform, AttachedObject._detectableField, AttachedObject._detectableFluid); var linearVelocity = AttachedObject._parentBody.GetPointVelocity(AttachedObject.transform.position) + AttachedObject.transform.TransformDirection(AttachedObject._launchDirection) * launchSpeed; var angularVelocity = AttachedObject.transform.forward * 2f; meteor.Launch(null, AttachedObject.transform.position, AttachedObject.transform.rotation, linearVelocity, angularVelocity); if (AttachedObject._audioSector.ContainsOccupant(DynamicOccupant.Player)) { AttachedObject._launchSource.pitch = Random.Range(0.4f, 0.6f); AttachedObject._launchSource.PlayOneShot(AudioType.BH_MeteorLaunch); } foreach (var launchParticle in AttachedObject._launchParticles) { launchParticle.Stop(); } } }