using UnityEngine; using UnityEngine.Networking; namespace RoR2.Projectile; [DisallowMultipleComponent] [RequireComponent(typeof(ProjectileController))] [RequireComponent(typeof(ProjectileImpactExplosion))] [RequireComponent(typeof(ProjectileOwnerOrbiter))] public class LunarSunProjectileController : MonoBehaviour { private ProjectileImpactExplosion explosion; public void OnEnable() { explosion = GetComponent(); if (NetworkServer.active) { ProjectileController component = GetComponent(); if ((bool)component.owner) { AcquireOwner(component); } else { component.onInitialized += AcquireOwner; } } } private void AcquireOwner(ProjectileController controller) { controller.onInitialized -= AcquireOwner; CharacterBody component = controller.owner.GetComponent(); if ((bool)component) { ProjectileOwnerOrbiter component2 = GetComponent(); component.GetComponent().InitializeOrbiter(component2, this); } } public void Detonate() { if ((bool)explosion) { explosion.Detonate(); } } }