Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Sp00ky Emotes Pack v1.1.2
sp00kyEmotes.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Logging; using EmotesAPI; using R2API; using R2API.Utils; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using sp00kyEmotes.Scripts; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace sp00kyEmotes { internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } public class DeadComp : MonoBehaviour { public BoneMapper boneMapper; private CharacterModel characterModel; private GameObject deadSkele; private int originalInvCount; private bool spawned; private void Start() { boneMapper = ((Component)this).GetComponent<BoneMapper>(); characterModel = boneMapper.model.gameObject.GetComponent<CharacterModel>(); originalInvCount = characterModel.invisibilityCount; } public void SpawnSkeleton() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!spawned && NetworkServer.active) { if (Object.op_Implicit((Object)(object)sp00kyEmotesPlugin.deadSkele)) { NetworkServer.Destroy(sp00kyEmotesPlugin.deadSkele); } deadSkele = CustomEmotesAPI.SpawnWorldProp(sp00kyEmotesPlugin.deadSkeleInt); deadSkele.transform.SetParent(((Component)characterModel).transform); deadSkele.transform.localPosition = new Vector3(0f, 0f, 1f); deadSkele.transform.localRotation = Quaternion.Euler(Vector3.zero); deadSkele.transform.SetParent((Transform)null); sp00kyEmotesPlugin.ScaleWorldProp(boneMapper, deadSkele); sp00kyEmotesPlugin.deadSkele = deadSkele; NetworkServer.Spawn(sp00kyEmotesPlugin.deadSkele); spawned = true; } } public void MakeInvisible() { if (characterModel.invisibilityCount == 0) { CharacterModel obj = characterModel; obj.invisibilityCount++; characterModel.visibility = (VisibilityLevel)0; } } public void Makevisible() { characterModel.invisibilityCount = originalInvCount; characterModel.visibility = (VisibilityLevel)3; } private void OnDestroy() { Makevisible(); } } public class WwiseTest : MonoBehaviour { public int msTime; private int[] times = new int[5] { 3780, 13890, 24000, 34100, 54310 }; public uint playingID; private bool check; public bool destroy; private AKRESULT aKRESULT; private BoneMapperTracker boneMapper; private void Start() { boneMapper = sp00kyEmotesPlugin.tracker.GetComponent<BoneMapperTracker>(); } private void Update() { if (playingID != 0) { UpdateSpeed(); } } private void UpdateSpeed() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) aKRESULT = AkSoundEngine.GetSourcePlayPosition(playingID, ref msTime); if (msTime < times[0]) { if (CustomEmotesAPI.localMapper.a2.speed != 1f) { boneMapper.UpdateSpeed(1f); } } else if (msTime < times[1] && msTime > times[0]) { if (CustomEmotesAPI.localMapper.a2.speed != 2f) { boneMapper.UpdateSpeed(2f); } } else if (msTime < times[2] && msTime > times[1]) { if (CustomEmotesAPI.localMapper.a2.speed != 4f) { boneMapper.UpdateSpeed(4f); } } else if (msTime < times[3] && msTime > times[2]) { if (CustomEmotesAPI.localMapper.a2.speed != 2f) { boneMapper.UpdateSpeed(2f); } } else if (msTime < times[4] && msTime > times[3]) { if (CustomEmotesAPI.localMapper.a2.speed != 4f) { boneMapper.UpdateSpeed(4f); } } else if (msTime > times[4] && msTime < 83350 && CustomEmotesAPI.localMapper.a2.speed != 2f) { boneMapper.UpdateSpeed(2f); } } private void FixedUpdate() { } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Sussy_Impostors_United_Inc.Sp00kyEmotePack", "Sp00kyEmotePack", "1.1.2")] [R2APISubmoduleDependency(new string[] { "SoundAPI", "PrefabAPI", "LegacyResourcesAPI", "NetworkingAPI" })] public class sp00kyEmotesPlugin : BaseUnityPlugin { public const string PluginGUID = "Sussy_Impostors_United_Inc.Sp00kyEmotePack"; public const string PluginAuthor = "Sussy_Impostors_United_Inc"; public const string PluginName = "Sp00kyEmotePack"; public const string PluginVersion = "1.1.2"; public static uint playingID; public static GameObject tracker; internal static int deadSkeleInt; internal static GameObject deadSkele; internal static int rattleEmInt; internal static GameObject rattleEm; public void Awake() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Expected O, but got Unknown //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Assets.Init(); CreateCollection(); CustomEmotesAPI.AddCustomAnimation(Assets.skeletons, false, "Play_Spooky_scary", "Stop_Spooky_scary", (HumanBodyBones[])null, (HumanBodyBones[])null, (AnimationClip)null, false, false, false, true, false, false); AnimationClipParams val = new AnimationClipParams(); val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.spookMonth }; val.looping = true; val._wwiseEventName = new string[1] { "Play_Scary_Swings_loop" }; val._wwiseStopEvent = new string[1] { "Stop_Scary_Swings_loop" }; val.dimWhenClose = false; val.syncAnim = true; val.syncAudio = true; val.customPostEventCodeSync = spookMonthPostEvent; CustomEmotesAPI.AddCustomAnimation(val); CustomEmotesAPI.AddCustomAnimation(Assets.tf2Heavy, false, "", "", (HumanBodyBones[])null, (HumanBodyBones[])null, (AnimationClip)null, false, false, false, true, false, false); CustomEmotesAPI.AddCustomAnimation(Assets.ghost, true, "Play_Spooky2", "Stop_Spooky2", (HumanBodyBones[])null, (HumanBodyBones[])null, (AnimationClip)null, false, false, false, true, true, true); CustomEmotesAPI.AddCustomAnimation(Assets.danceSkel, true, "Play_Spooky3", "Stop_Spooky3", (HumanBodyBones[])null, (HumanBodyBones[])null, (AnimationClip)null, false, false, false, true, true, true); AnimationClipParams val2 = new AnimationClipParams(); val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.skeletonsStart }; val2.looping = false; val2.syncAnim = true; val2.syncAudio = true; val2.secondaryAnimation = (AnimationClip[])(object)new AnimationClip[1] { Assets.skeletonsLoop }; val2.customName = "spooky skele loop"; val2._wwiseEventName = new string[1] { "Play_Spooky_scary" }; val2._wwiseStopEvent = new string[1] { "Stop_Spooky_scary" }; CustomEmotesAPI.AddCustomAnimation(val2); AnimationClipParams val3 = new AnimationClipParams(); val3.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.idle }; val3.looping = true; val3._wwiseEventName = new string[1] { "Play_Man_im_dead" }; val3._wwiseStopEvent = new string[1] { "Stop_Man_im_dead" }; val3.dimWhenClose = false; val3.syncAnim = false; val3.syncAudio = false; val3.customPostEventCodeSync = ImDeadPostEvent; CustomEmotesAPI.AddCustomAnimation(val3); CustomEmotesAPI.AddNonAnimatingEmote("Rattle em Boys!", true); CustomEmotesAPI.BlackListEmote("Rattle em Boys!"); CustomEmotesAPI.AddNonAnimatingEmote("Delete Rattle em", true); CustomEmotesAPI.BlackListEmote("Delete Rattle em"); AnimationClipParams val4 = new AnimationClipParams(); val4.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.linkStart }; val4.secondaryAnimation = (AnimationClip[])(object)new AnimationClip[1] { Assets.linkLoop }; val4.looping = true; val4.dimWhenClose = false; val4.syncAnim = false; val4.syncAudio = false; CustomEmotesAPI.AddCustomAnimation(val4); CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged); CustomEmotesAPI.animJoined += new AnimationJoined(CustomEmotesAPI_animJoined); } private void Start() { Assets.LoadAddressables(); } private void CustomEmotesAPI_animJoined(string joinedAnimation, BoneMapper joiner, BoneMapper host) { } public static void ScaleWorldProp(BoneMapper animationPlayer, GameObject prop) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Transform parent = prop.transform.parent; float scale = animationPlayer.scale; if ((Object)(object)prop.transform.parent == (Object)null) { Transform transform = prop.transform; transform.localScale *= scale; return; } prop.transform.SetParent((Transform)null); Transform transform2 = prop.transform; transform2.localScale *= scale; prop.transform.SetParent(parent); } private void CreateCollection() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0057: Expected O, but got Unknown GameObject val = new GameObject { name = "spookyEmoteTracker" }; val.transform.position = Vector3.zero; val.transform.rotation = Quaternion.Euler(Vector3.zero); val.transform.localScale = Vector3.one; val.AddComponent<BoneMapperTracker>(); Object.DontDestroyOnLoad((Object)val); tracker = val; } private static void spookMonthPostEvent(BoneMapper mapper) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown playingID = AkSoundEngine.PostEvent(BoneMapper.startEvents[mapper.currentClip.syncPos][mapper.currEvent], CustomEmotesAPI.audioContainers[mapper.currentClip.syncPos], 1048576u, new EventCallback(SpookCallbackFunction), (object)null); } private static void ImDeadPostEvent(BoneMapper mapper) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown AkSoundEngine.PostEvent(BoneMapper.startEvents[mapper.currentClip.syncPos][mapper.currEvent], CustomEmotesAPI.audioContainers[mapper.currentClip.syncPos], 1u, new EventCallback(ImDeadCallbackFunction), (object)null); } private static void SpookCallbackFunction(object in_cookie, AkCallbackType in_type, object in_info) { } private static void ImDeadCallbackFunction(object in_cookie, AkCallbackType in_type, AkCallbackInfo in_info) { } private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) int num = -1; if (newAnimation == "spooky dance") { if (!tracker.GetComponent<BoneMapperTracker>().boneMappers.Contains(mapper)) { tracker.GetComponent<BoneMapperTracker>().boneMappers.Add(mapper); } num = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.spookyDanceGO)); mapper.props[num].GetComponent<WwiseTest>().playingID = playingID; mapper.props[num].transform.SetParent(((Component)mapper).transform.parent); mapper.props[num].transform.localEulerAngles = Vector3.zero; mapper.props[num].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } if (newAnimation != "spooky dance" && tracker.GetComponent<BoneMapperTracker>().boneMappers.Contains(mapper)) { tracker.GetComponent<BoneMapperTracker>().boneMappers.Remove(mapper); } if (newAnimation == "Spawn Redead") { num = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Redead)); mapper.props[num].transform.SetParent(((Component)mapper).transform.parent); mapper.props[num].transform.localRotation = Quaternion.Euler(Vector3.zero); mapper.props[num].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } if (newAnimation == "ImDead" && !Object.op_Implicit((Object)(object)((Component)mapper).gameObject.GetComponent<DeadComp>())) { ((Component)mapper).gameObject.AddComponent<DeadComp>(); } if (newAnimation != "ImDead" && Object.op_Implicit((Object)(object)((Component)mapper).gameObject.GetComponent<DeadComp>())) { ((Component)mapper).gameObject.GetComponent<DeadComp>().Makevisible(); Object.Destroy((Object)(object)((Component)mapper).gameObject.GetComponent<DeadComp>()); } if (newAnimation == "Rattle em Boys!" && NetworkServer.active) { if (Object.op_Implicit((Object)(object)rattleEm)) { NetworkServer.Destroy(rattleEm); } rattleEm = CustomEmotesAPI.SpawnWorldProp(rattleEmInt); rattleEm.transform.SetParent(((Component)mapper).transform.parent); rattleEm.transform.localPosition = new Vector3(0f, 0f, 2.5f); rattleEm.transform.localRotation = Quaternion.Euler(Vector3.zero); rattleEm.transform.SetParent((Transform)null); NetworkServer.Spawn(rattleEm); } if (newAnimation == "Delete Rattle em" && NetworkServer.active && Object.op_Implicit((Object)(object)rattleEm)) { NetworkServer.Destroy(rattleEm); } } } } namespace sp00kyEmotes.Scripts { public static class Assets { internal const string assetBundleName = "sp00kAssets"; internal const string soundBankName = "Spooky_Month_Pack"; internal static AssetBundle mainAssetBundle; public static AnimationClip skeletons; public static AnimationClip skeletonsStart; public static AnimationClip skeletonsLoop; public static AnimationClip ghost; public static AnimationClip spookMonth; public static AnimationClip tf2Heavy; public static AnimationClip danceSkel; public static GameObject spookyDanceGO; public static AnimationClip spookyMonth2; public static GameObject Redead; public static GameObject deadSkele; public static AnimationClip idle; public static GameObject rattleEm; public static GameObject muzzleFlashPrefab; public static GameObject tracerPrefab; public static GameObject hitEffectPrefab; public static GameObject ejectPrefab; public static AnimationClip linkStart; public static AnimationClip linkLoop; internal static void Init() { LoadAssetBundle(); LoadSoundBank(); PopulateAssets(); } internal static void PopulateAssets() { if (!Object.op_Implicit((Object)(object)mainAssetBundle)) { Log.LogError("Sp00kyEmotePack: assetBundle not Found."); return; } skeletons = mainAssetBundle.LoadAsset<AnimationClip>("spooky skele"); skeletonsStart = mainAssetBundle.LoadAsset<AnimationClip>("spooky skele loop"); skeletonsLoop = mainAssetBundle.LoadAsset<AnimationClip>("spookylooping"); ghost = mainAssetBundle.LoadAsset<AnimationClip>("spinning ghost"); spookMonth = mainAssetBundle.LoadAsset<AnimationClip>("spooky dance"); tf2Heavy = mainAssetBundle.LoadAsset<AnimationClip>("heavythriller"); danceSkel = mainAssetBundle.LoadAsset<AnimationClip>("skele dance"); spookyDanceGO = mainAssetBundle.LoadAsset<GameObject>("SpookyDance"); Redead = mainAssetBundle.LoadAsset<GameObject>("redead"); linkStart = mainAssetBundle.LoadAsset<AnimationClip>("Spawn Redead"); linkLoop = mainAssetBundle.LoadAsset<AnimationClip>("redeadLinkAttackLoop"); deadSkele = mainAssetBundle.LoadAsset<GameObject>("imDeadSkele"); sp00kyEmotesPlugin.deadSkeleInt = CustomEmotesAPI.RegisterWorldProp(deadSkele, (JoinSpot[])(object)new JoinSpot[0]); idle = mainAssetBundle.LoadAsset<AnimationClip>("ImDead"); rattleEm = mainAssetBundle.LoadAsset<GameObject>("RattleEm"); sp00kyEmotesPlugin.rattleEmInt = CustomEmotesAPI.RegisterWorldProp(rattleEm, (JoinSpot[])(object)new JoinSpot[0]); } internal static void LoadAssetBundle() { if ((Object)(object)mainAssetBundle == (Object)null) { mainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sp00kAssets")); if (!Object.op_Implicit((Object)(object)mainAssetBundle)) { Log.LogError("Sp00kyEmotePack: assetBundle not Found."); } } } internal static void LoadAddressables() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) muzzleFlashPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/Muzzleflash1.prefab").WaitForCompletion(); tracerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/TracerCommandoDefault.prefab").WaitForCompletion(); hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/HitsparkCommando.prefab").WaitForCompletion(); ejectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2Reload.prefab").WaitForCompletion(); } internal static void LoadSoundBank() { SoundBanks.Add(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Spooky_Month_Pack.bnk")); } } public class BoneMapperTracker : MonoBehaviour { public float speedVar; public List<BoneMapper> boneMappers; private int oldVal; public int curVal; private void Start() { boneMappers = new List<BoneMapper>(); speedVar = 1f; oldVal = 0; curVal = 0; } private void FixedUpdate() { curVal = boneMappers.Count; if (curVal == oldVal) { return; } if (curVal > oldVal) { foreach (BoneMapper boneMapper in boneMappers) { _ = boneMapper; UpdateSpeed(speedVar); } } oldVal = curVal; } public void CheckMappers(string animName) { foreach (BoneMapper boneMapper in boneMappers) { if (((Object)boneMapper.currentClip).name != animName) { boneMappers.Remove(boneMapper); } } } public void UpdateSpeed(float speed) { foreach (BoneMapper boneMapper in boneMappers) { boneMapper.SetAnimationSpeed(speed); speedVar = speed; } } } public class RattleEvents : MonoBehaviour { private GameObject muzzleFlashPrefab; private GameObject tracerPrefab; private GameObject hitEffectPrefab; private GameObject ejectPrefab; private float damage = 1f; private float damageCoef = 1f; private float force = 50f; private BulletAttack bulletAttack; private Ray aimRay; private ChildLocator childLocator; private NetworkIdentity identity; private EffectData muzzleFlash; private EffectData effectData; private void Start() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) muzzleFlashPrefab = Assets.muzzleFlashPrefab; tracerPrefab = Assets.tracerPrefab; hitEffectPrefab = Assets.hitEffectPrefab; ejectPrefab = Assets.ejectPrefab; aimRay = new Ray(((Component)this).transform.position, ((Component)this).transform.forward); identity = ((Component)((Component)this).transform.root).GetComponent<NetworkIdentity>(); childLocator = ((Component)this).GetComponent<ChildLocator>(); muzzleFlash = new EffectData(); muzzleFlash.SetNetworkedObjectReference(childLocator.FindChildGameObject("Muzzle")); muzzleFlash.origin = muzzleFlash.rootObject.transform.position; muzzleFlash.rotation = muzzleFlash.rootObject.transform.rotation; effectData = new EffectData(); effectData.SetNetworkedObjectReference(childLocator.FindChildGameObject("Eject")); effectData.origin = effectData.rootObject.transform.position; } private void Update() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) muzzleFlash.origin = childLocator.FindChildGameObject("Muzzle").transform.position; muzzleFlash.rotation = muzzleFlash.rootObject.transform.rotation; effectData.origin = childLocator.FindChildGameObject("Eject").transform.position; effectData.rotation = effectData.rootObject.transform.rotation; } public void Shoot() { EffectManager.SpawnEffect(muzzleFlashPrefab, muzzleFlash, false); EffectManager.SpawnEffect(ejectPrefab, effectData, false); } } public class SpawnSound : MonoBehaviour { [SerializeField] private string soundName; [SerializeField] private string stopSound; private void Start() { Util.PlaySound(soundName, ((Component)this).gameObject); } private void Update() { } private void OnDestroy() { if (stopSound != null) { Util.PlaySound(stopSound, ((Component)this).gameObject); } } } public class TestEvents : MonoBehaviour { [SerializeField] public List<CharacterJoint> CharacterJointColliders; private float timer = 3f; private bool startTimer; private void FixedUpdate() { if (timer > 0f && startTimer) { timer -= Time.fixedDeltaTime; } if (timer <= 0f && startTimer) { DisableRagdoll(); startTimer = false; } } public void DisableRagdoll() { CapsuleCollider val = default(CapsuleCollider); SphereCollider val2 = default(SphereCollider); foreach (CharacterJoint characterJointCollider in CharacterJointColliders) { if (((Component)characterJointCollider).gameObject.TryGetComponent<CapsuleCollider>(ref val)) { val.radius = 0.2f; } else if (((Component)characterJointCollider).gameObject.TryGetComponent<SphereCollider>(ref val2)) { val2.radius = 0.5f; } Object.Destroy((Object)(object)characterJointCollider); } Util.PlaySound("Play_Skeleton_explode", ((Component)this).gameObject); } public void EnableRagdoll() { ((Behaviour)((Component)this).gameObject.GetComponent<Animator>()).enabled = false; startTimer = true; } } }