Beispiel #1
0
 public static void Postfix(FMOD_StudioEventEmitter __instance, bool allowFadeout)
 {
     if (fmodSystem.IsWhitelisted(__instance.asset.path))
     {
         __instance.TryGetComponent(out NitroxEntity nitroxEntity);
         if (!nitroxEntity)
         {
             nitroxEntity = __instance.GetComponentInParent <NitroxEntity>();
         }
         if (nitroxEntity)
         {
             fmodSystem.PlayStudioEmitter(nitroxEntity.Id, __instance.asset.path, false, allowFadeout);
         }
     }
 }
 public static void Postfix(FMOD_StudioEventEmitter __instance, float ____lastTimePlayed)
 {
     if (fmodSystem.IsWhitelisted(__instance.asset.path))
     {
         if (____lastTimePlayed == 0.0 || Time.time > ____lastTimePlayed + __instance.minInterval)
         {
             __instance.TryGetComponent(out NitroxEntity nitroxEntity);
             if (!nitroxEntity)
             {
                 nitroxEntity = __instance.GetComponentInParent <NitroxEntity>();
             }
             if (nitroxEntity)
             {
                 fmodSystem.PlayStudioEmitter(nitroxEntity.Id, __instance.asset.path, true, false);
             }
         }
     }
 }
        public static void Postfix(FMOD_StudioEventEmitter __instance)
        {
            if (fmodSystem.IsWhitelisted(__instance.asset.path, out bool _, out float radius))
            {
                if (!__instance.TryGetComponent(out NitroxEntity entity))
                {
                    entity = __instance.GetComponentInParent <NitroxEntity>();
                    if (!entity)
                    {
                        Log.Warn($"[FMOD_CustomEmitter_Start_Patch] - No NitroxEntity for \"{__instance.asset.path}\" found!");
                        return;
                    }
                }

                if (!entity.gameObject.TryGetComponent(out FMODEmitterController fmodController))
                {
                    fmodController = entity.gameObject.AddComponent <FMODEmitterController>();
                }
                fmodController.AddEmitter(__instance.asset.path, __instance, radius);
            }
        }