using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using FistVR; using HarmonyLib; using OtherLoader; using Sodalite.Api; using UnityEngine; using UnityEngine.UI; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] public class PassiveSosigFixer : MonoBehaviour { private Sosig mySosig; private void Awake() { mySosig = ((Component)this).GetComponent().S; if ((Object)(object)mySosig != (Object)null) { mySosig.IgnoresNeedForWeapons = true; } } } [RequireComponent(typeof(ParticleSystem))] public class CFX_AutoStopLoopedEffect : MonoBehaviour { public float effectDuration = 2.5f; private float d; private void OnEnable() { d = effectDuration; } private void Update() { if (!(d > 0f)) { return; } d -= Time.deltaTime; if (d <= 0f) { ((Component)this).GetComponent().Stop(true); CFX_Demo_Translate component = ((Component)this).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } } } } public class CFX_Demo_RandomDir : MonoBehaviour { public Vector3 min = new Vector3(0f, 0f, 0f); public Vector3 max = new Vector3(0f, 360f, 0f); private void Awake() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.eulerAngles = new Vector3(Random.Range(min.x, max.x), Random.Range(min.y, max.y), Random.Range(min.z, max.z)); } } public class CFX_Demo_RotateCamera : MonoBehaviour { public static bool rotating = true; public float speed = 30f; public Transform rotationCenter; private void Update() { //IL_0017: 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) if (rotating) { ((Component)this).transform.RotateAround(rotationCenter.position, Vector3.up, speed * Time.deltaTime); } } } public class CFX_Demo_Translate : MonoBehaviour { public float speed = 30f; public Vector3 rotation = Vector3.forward; public Vector3 axis = Vector3.forward; public bool gravity; private Vector3 dir; private void Start() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0051: Unknown result type (might be due to invalid IL or missing references) dir = new Vector3(Random.Range(0f, 360f), Random.Range(0f, 360f), Random.Range(0f, 360f)); ((Vector3)(ref dir)).Scale(rotation); ((Component)this).transform.localEulerAngles = dir; } private void Update() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.Translate(axis * speed * Time.deltaTime, (Space)1); } } public class WFX_Demo : MonoBehaviour { public float cameraSpeed = 10f; public bool orderedSpawns = true; public float step = 1f; public float range = 5f; private float order = -5f; public GameObject walls; public GameObject bulletholes; public GameObject[] ParticleExamples; private int exampleIndex; private string randomSpawnsDelay = "0.5"; private bool randomSpawns; private bool slowMo; private bool rotateCam = true; public Material wood; public Material concrete; public Material metal; public Material checker; public Material woodWall; public Material concreteWall; public Material metalWall; public Material checkerWall; private string groundTextureStr = "Checker"; private List groundTextures = new List(new string[4] { "Concrete", "Wood", "Metal", "Checker" }); public GameObject m4; public GameObject m4fps; private bool rotate_m4 = true; private void OnMouseDown() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (((Component)this).GetComponent().Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f)) { GameObject val2 = spawnParticle(); if (!((Object)val2).name.StartsWith("WFX_MF")) { val2.transform.position = ((RaycastHit)(ref val)).point + val2.transform.position; } } } public GameObject spawnParticle() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(ParticleExamples[exampleIndex]); if (((Object)val).name.StartsWith("WFX_MF")) { val.transform.parent = ParticleExamples[exampleIndex].transform.parent; val.transform.localPosition = ParticleExamples[exampleIndex].transform.localPosition; val.transform.localRotation = ParticleExamples[exampleIndex].transform.localRotation; } else if (((Object)val).name.Contains("Hole")) { val.transform.parent = bulletholes.transform; } SetActiveCrossVersions(val, active: true); return val; } private void SetActiveCrossVersions(GameObject obj, bool active) { obj.SetActive(active); for (int i = 0; i < obj.transform.childCount; i++) { ((Component)obj.transform.GetChild(i)).gameObject.SetActive(active); } } private void OnGUI() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginArea(new Rect(5f, 20f, (float)(Screen.width - 10), 60f)); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Effect: " + ((Object)ParticleExamples[exampleIndex]).name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) }); if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { prevParticle(); } if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { nextParticle(); } GUILayout.FlexibleSpace(); GUILayout.Label("Click on the ground to spawn the selected effect", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button((!rotateCam) ? "Rotate Camera" : "Pause Camera", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) })) { rotateCam = !rotateCam; } if (GUILayout.Button((!((Component)this).GetComponent().enabled) ? "Show Ground" : "Hide Ground", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { ((Component)this).GetComponent().enabled = !((Component)this).GetComponent().enabled; } if (GUILayout.Button((!slowMo) ? "Slow Motion" : "Normal Speed", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) })) { slowMo = !slowMo; if (slowMo) { Time.timeScale = 0.33f; } else { Time.timeScale = 1f; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Ground texture: " + groundTextureStr, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { prevTexture(); } if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { nextTexture(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); if (!m4.GetComponent().enabled) { return; } GUILayout.BeginArea(new Rect(5f, (float)(Screen.height - 100), (float)(Screen.width - 10), 90f)); rotate_m4 = GUILayout.Toggle(rotate_m4, "AutoRotate Weapon", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }); GUI.enabled = !rotate_m4; float x = m4.transform.localEulerAngles.x; x = ((!(x > 90f)) ? x : (x - 180f)); float y = m4.transform.localEulerAngles.y; float z = m4.transform.localEulerAngles.z; x = GUILayout.HorizontalSlider(x, 0f, 179f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) }); y = GUILayout.HorizontalSlider(y, 0f, 359f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) }); z = GUILayout.HorizontalSlider(z, 0f, 359f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) }); if (GUI.changed) { if (x > 90f) { x += 180f; } m4.transform.localEulerAngles = new Vector3(x, y, z); Debug.Log((object)x); } GUILayout.EndArea(); } private IEnumerator RandomSpawnsCoroutine() { while (true) { GameObject particles = spawnParticle(); if (orderedSpawns) { particles.transform.position = ((Component)this).transform.position + new Vector3(order, particles.transform.position.y, 0f); order -= step; if (order < 0f - range) { order = range; } } else { particles.transform.position = ((Component)this).transform.position + new Vector3(Random.Range(0f - range, range), 0f, Random.Range(0f - range, range)) + new Vector3(0f, particles.transform.position.y, 0f); } yield return (object)new WaitForSeconds(float.Parse(randomSpawnsDelay)); } } private void Update() { //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) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)276)) { prevParticle(); } else if (Input.GetKeyDown((KeyCode)275)) { nextParticle(); } if (rotateCam) { ((Component)Camera.main).transform.RotateAround(Vector3.zero, Vector3.up, cameraSpeed * Time.deltaTime); } if (rotate_m4) { m4.transform.Rotate(new Vector3(0f, 40f, 0f) * Time.deltaTime, (Space)0); } } private void prevTexture() { int num = groundTextures.IndexOf(groundTextureStr); num--; if (num < 0) { num = groundTextures.Count - 1; } groundTextureStr = groundTextures[num]; selectMaterial(); } private void nextTexture() { int num = groundTextures.IndexOf(groundTextureStr); num++; if (num >= groundTextures.Count) { num = 0; } groundTextureStr = groundTextures[num]; selectMaterial(); } private void selectMaterial() { switch (groundTextureStr) { case "Concrete": ((Component)this).GetComponent().material = concrete; ((Component)walls.transform.GetChild(0)).GetComponent().material = concreteWall; ((Component)walls.transform.GetChild(1)).GetComponent().material = concreteWall; break; case "Wood": ((Component)this).GetComponent().material = wood; ((Component)walls.transform.GetChild(0)).GetComponent().material = woodWall; ((Component)walls.transform.GetChild(1)).GetComponent().material = woodWall; break; case "Metal": ((Component)this).GetComponent().material = metal; ((Component)walls.transform.GetChild(0)).GetComponent().material = metalWall; ((Component)walls.transform.GetChild(1)).GetComponent().material = metalWall; break; case "Checker": ((Component)this).GetComponent().material = checker; ((Component)walls.transform.GetChild(0)).GetComponent().material = checkerWall; ((Component)walls.transform.GetChild(1)).GetComponent().material = checkerWall; break; } } private void prevParticle() { exampleIndex--; if (exampleIndex < 0) { exampleIndex = ParticleExamples.Length - 1; } showHideStuff(); } private void nextParticle() { exampleIndex++; if (exampleIndex >= ParticleExamples.Length) { exampleIndex = 0; } showHideStuff(); } private void showHideStuff() { if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF Spr")) { m4.GetComponent().enabled = true; } else { m4.GetComponent().enabled = false; } if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF FPS")) { m4fps.GetComponent().enabled = true; } else { m4fps.GetComponent().enabled = false; } if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_BImpact")) { SetActiveCrossVersions(walls, active: true); Renderer[] componentsInChildren = bulletholes.GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.enabled = true; } } else { SetActiveCrossVersions(walls, active: false); Renderer[] componentsInChildren2 = bulletholes.GetComponentsInChildren(); Renderer[] array2 = componentsInChildren2; foreach (Renderer val2 in array2) { val2.enabled = false; } } if (((Object)ParticleExamples[exampleIndex]).name.Contains("Wood")) { groundTextureStr = "Wood"; selectMaterial(); } else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Concrete")) { groundTextureStr = "Concrete"; selectMaterial(); } else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Metal")) { groundTextureStr = "Metal"; selectMaterial(); } else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Dirt") || ((Object)ParticleExamples[exampleIndex]).name.Contains("Sand") || ((Object)ParticleExamples[exampleIndex]).name.Contains("SoftBody")) { groundTextureStr = "Checker"; selectMaterial(); } else if (((Object)ParticleExamples[exampleIndex]).name == "WFX_Explosion") { groundTextureStr = "Checker"; selectMaterial(); } } } public class WFX_Demo_DeleteAfterDelay : MonoBehaviour { public float delay = 1f; private void Update() { delay -= Time.deltaTime; if (delay < 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class WFX_Demo_New : MonoBehaviour { public Renderer groundRenderer; public Collider groundCollider; [Space] [Space] public Image slowMoBtn; public Text slowMoLabel; public Image camRotBtn; public Text camRotLabel; public Image groundBtn; public Text groundLabel; [Space] public Text EffectLabel; public Text EffectIndexLabel; public GameObject[] AdditionalEffects; public GameObject ground; public GameObject walls; public GameObject bulletholes; public GameObject m4; public GameObject m4fps; public Material wood; public Material concrete; public Material metal; public Material checker; public Material woodWall; public Material concreteWall; public Material metalWall; public Material checkerWall; private string groundTextureStr = "Checker"; private List groundTextures = new List(new string[4] { "Concrete", "Wood", "Metal", "Checker" }); private GameObject[] ParticleExamples; private int exampleIndex; private bool slowMo; private Vector3 defaultCamPosition; private Quaternion defaultCamRotation; private List onScreenParticles = new List(); private void Awake() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int childCount = ((Component)this).transform.childCount; for (int i = 0; i < childCount; i++) { GameObject gameObject = ((Component)((Component)this).transform.GetChild(i)).gameObject; list.Add(gameObject); } list.AddRange(AdditionalEffects); ParticleExamples = list.ToArray(); defaultCamPosition = ((Component)Camera.main).transform.position; defaultCamRotation = ((Component)Camera.main).transform.rotation; ((MonoBehaviour)this).StartCoroutine("CheckForDeletedParticles"); UpdateUI(); } private void Update() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)276)) { prevParticle(); } else if (Input.GetKeyDown((KeyCode)275)) { nextParticle(); } else if (Input.GetKeyDown((KeyCode)127)) { destroyParticles(); } if (Input.GetMouseButtonDown(0)) { RaycastHit val = default(RaycastHit); if (groundCollider.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f)) { GameObject val2 = spawnParticle(); if (!((Object)val2).name.StartsWith("WFX_MF")) { val2.transform.position = ((RaycastHit)(ref val)).point + val2.transform.position; } } } float axis = Input.GetAxis("Mouse ScrollWheel"); if (axis != 0f) { ((Component)Camera.main).transform.Translate(Vector3.forward * ((!(axis < 0f)) ? 1f : (-1f)), (Space)1); } if (Input.GetMouseButtonDown(2)) { ((Component)Camera.main).transform.position = defaultCamPosition; ((Component)Camera.main).transform.rotation = defaultCamRotation; } } public void OnToggleGround() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0058: Unknown result type (might be due to invalid IL or missing references) Color white = Color.white; groundRenderer.enabled = !groundRenderer.enabled; white.a = ((!groundRenderer.enabled) ? 0.33f : 1f); ((Graphic)groundBtn).color = white; ((Graphic)groundLabel).color = white; } public void OnToggleCamera() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Color white = Color.white; CFX_Demo_RotateCamera.rotating = !CFX_Demo_RotateCamera.rotating; white.a = ((!CFX_Demo_RotateCamera.rotating) ? 0.33f : 1f); ((Graphic)camRotBtn).color = white; ((Graphic)camRotLabel).color = white; } public void OnToggleSlowMo() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Color white = Color.white; slowMo = !slowMo; if (slowMo) { Time.timeScale = 0.33f; white.a = 1f; } else { Time.timeScale = 1f; white.a = 0.33f; } ((Graphic)slowMoBtn).color = white; ((Graphic)slowMoLabel).color = white; } public void OnPreviousEffect() { prevParticle(); } public void OnNextEffect() { nextParticle(); } private void UpdateUI() { EffectLabel.text = ((Object)ParticleExamples[exampleIndex]).name; EffectIndexLabel.text = string.Format("{0}/{1}", (exampleIndex + 1).ToString("00"), ParticleExamples.Length.ToString("00")); } public GameObject spawnParticle() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(ParticleExamples[exampleIndex]); val.transform.position = new Vector3(0f, val.transform.position.y, 0f); val.SetActive(true); if (((Object)val).name.StartsWith("WFX_MF")) { val.transform.parent = ParticleExamples[exampleIndex].transform.parent; val.transform.localPosition = ParticleExamples[exampleIndex].transform.localPosition; val.transform.localRotation = ParticleExamples[exampleIndex].transform.localRotation; } else if (((Object)val).name.Contains("Hole")) { val.transform.parent = bulletholes.transform; } ParticleSystem component = val.GetComponent(); if ((Object)(object)component != (Object)null) { MainModule main = component.main; if (((MainModule)(ref main)).loop) { ((Component)component).gameObject.AddComponent(); ((Component)component).gameObject.AddComponent(); } } onScreenParticles.Add(val); return val; } private IEnumerator CheckForDeletedParticles() { while (true) { yield return (object)new WaitForSeconds(5f); for (int num = onScreenParticles.Count - 1; num >= 0; num--) { if ((Object)(object)onScreenParticles[num] == (Object)null) { onScreenParticles.RemoveAt(num); } } } } private void prevParticle() { exampleIndex--; if (exampleIndex < 0) { exampleIndex = ParticleExamples.Length - 1; } UpdateUI(); showHideStuff(); } private void nextParticle() { exampleIndex++; if (exampleIndex >= ParticleExamples.Length) { exampleIndex = 0; } UpdateUI(); showHideStuff(); } private void destroyParticles() { for (int num = onScreenParticles.Count - 1; num >= 0; num--) { if ((Object)(object)onScreenParticles[num] != (Object)null) { Object.Destroy((Object)(object)onScreenParticles[num]); } onScreenParticles.RemoveAt(num); } } private void prevTexture() { int num = groundTextures.IndexOf(groundTextureStr); num--; if (num < 0) { num = groundTextures.Count - 1; } groundTextureStr = groundTextures[num]; selectMaterial(); } private void nextTexture() { int num = groundTextures.IndexOf(groundTextureStr); num++; if (num >= groundTextures.Count) { num = 0; } groundTextureStr = groundTextures[num]; selectMaterial(); } private void selectMaterial() { switch (groundTextureStr) { case "Concrete": ground.GetComponent().material = concrete; ((Component)walls.transform.GetChild(0)).GetComponent().material = concreteWall; ((Component)walls.transform.GetChild(1)).GetComponent().material = concreteWall; break; case "Wood": ground.GetComponent().material = wood; ((Component)walls.transform.GetChild(0)).GetComponent().material = woodWall; ((Component)walls.transform.GetChild(1)).GetComponent().material = woodWall; break; case "Metal": ground.GetComponent().material = metal; ((Component)walls.transform.GetChild(0)).GetComponent().material = metalWall; ((Component)walls.transform.GetChild(1)).GetComponent().material = metalWall; break; case "Checker": ground.GetComponent().material = checker; ((Component)walls.transform.GetChild(0)).GetComponent().material = checkerWall; ((Component)walls.transform.GetChild(1)).GetComponent().material = checkerWall; break; } } private void showHideStuff() { //IL_004d: 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) if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF Spr")) { m4.GetComponent().enabled = true; ((Component)Camera.main).transform.position = new Vector3(-2.482457f, 3.263842f, -0.004924395f); ((Component)Camera.main).transform.eulerAngles = new Vector3(20f, 90f, 0f); } else { m4.GetComponent().enabled = false; } if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF FPS")) { m4fps.GetComponent().enabled = true; } else { m4fps.GetComponent().enabled = false; } if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_BImpact")) { walls.SetActive(true); Renderer[] componentsInChildren = bulletholes.GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.enabled = true; } } else { walls.SetActive(false); Renderer[] componentsInChildren2 = bulletholes.GetComponentsInChildren(); Renderer[] array2 = componentsInChildren2; foreach (Renderer val2 in array2) { val2.enabled = false; } } if (((Object)ParticleExamples[exampleIndex]).name.Contains("Wood")) { groundTextureStr = "Wood"; selectMaterial(); } else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Concrete")) { groundTextureStr = "Concrete"; selectMaterial(); } else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Metal")) { groundTextureStr = "Metal"; selectMaterial(); } else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Dirt") || ((Object)ParticleExamples[exampleIndex]).name.Contains("Sand") || ((Object)ParticleExamples[exampleIndex]).name.Contains("SoftBody")) { groundTextureStr = "Checker"; selectMaterial(); } else if (((Object)ParticleExamples[exampleIndex]).name == "WFX_Explosion") { groundTextureStr = "Checker"; selectMaterial(); } } } public class WFX_Demo_RandomDir : MonoBehaviour { public Vector3 min = new Vector3(0f, 0f, 0f); public Vector3 max = new Vector3(0f, 360f, 0f); private void Awake() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.eulerAngles = new Vector3(Random.Range(min.x, max.x), Random.Range(min.y, max.y), Random.Range(min.z, max.z)); } } public class WFX_Demo_Wall : MonoBehaviour { public WFX_Demo_New demo; private void OnMouseDown() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) RaycastHit val = default(RaycastHit); if (((Component)this).GetComponent().Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f)) { GameObject val2 = demo.spawnParticle(); val2.transform.position = ((RaycastHit)(ref val)).point; val2.transform.rotation = Quaternion.FromToRotation(Vector3.forward, ((RaycastHit)(ref val)).normal); } } } [RequireComponent(typeof(ParticleSystem))] public class CFX_AutoDestructShuriken : MonoBehaviour { public bool OnlyDeactivate; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine("CheckIfAlive"); } private IEnumerator CheckIfAlive() { do { yield return (object)new WaitForSeconds(0.5f); } while (((Component)this).GetComponent().IsAlive(true)); if (OnlyDeactivate) { ((Component)this).gameObject.SetActive(false); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } [RequireComponent(typeof(Light))] public class CFX_LightIntensityFade : MonoBehaviour { public float duration = 1f; public float delay = 0f; public float finalIntensity = 0f; private float baseIntensity; public bool autodestruct; private float p_lifetime = 0f; private float p_delay; private void Start() { baseIntensity = ((Component)this).GetComponent().intensity; } private void OnEnable() { p_lifetime = 0f; p_delay = delay; if (delay > 0f) { ((Behaviour)((Component)this).GetComponent()).enabled = false; } } private void Update() { if (p_delay > 0f) { p_delay -= Time.deltaTime; if (p_delay <= 0f) { ((Behaviour)((Component)this).GetComponent()).enabled = true; } } else if (p_lifetime / duration < 1f) { ((Component)this).GetComponent().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration); p_lifetime += Time.deltaTime; } else if (autodestruct) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } [RequireComponent(typeof(MeshFilter))] public class WFX_BulletHoleDecal : MonoBehaviour { private static Vector2[] quadUVs = (Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(1f, 0f), new Vector2(1f, 1f) }; public float lifetime = 10f; public float fadeoutpercent = 80f; public Vector2 frames; public bool randomRotation = false; public bool deactivate = false; private float life; private float fadeout; private Color color; private float orgAlpha; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) color = ((Component)this).GetComponent().material.GetColor("_TintColor"); orgAlpha = color.a; } private void OnEnable() { //IL_014d: Unknown result type (might be due to invalid IL or missing references) int num = Random.Range(0, (int)(frames.x * frames.y)); int num2 = (int)((float)num % frames.x); int num3 = (int)((float)num / frames.y); Vector2[] array = (Vector2[])(object)new Vector2[4]; for (int i = 0; i < 4; i++) { array[i].x = (quadUVs[i].x + (float)num2) * (1f / frames.x); array[i].y = (quadUVs[i].y + (float)num3) * (1f / frames.y); } ((Component)this).GetComponent().mesh.uv = array; if (randomRotation) { ((Component)this).transform.Rotate(0f, 0f, Random.Range(0f, 360f), (Space)1); } life = lifetime; fadeout = life * (fadeoutpercent / 100f); color.a = orgAlpha; ((Component)this).GetComponent().material.SetColor("_TintColor", color); ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine("holeUpdate"); } private IEnumerator holeUpdate() { while (life > 0f) { life -= Time.deltaTime; if (life <= fadeout) { color.a = Mathf.Lerp(0f, orgAlpha, life / fadeout); ((Component)this).GetComponent().material.SetColor("_TintColor", color); } yield return null; } } } [RequireComponent(typeof(Light))] public class WFX_LightFlicker : MonoBehaviour { public float time = 0.05f; private float timer; private void Start() { timer = time; ((MonoBehaviour)this).StartCoroutine("Flicker"); } private IEnumerator Flicker() { while (true) { ((Behaviour)((Component)this).GetComponent()).enabled = !((Behaviour)((Component)this).GetComponent()).enabled; do { timer -= Time.deltaTime; yield return null; } while (timer > 0f); timer = time; } } } public class CFX_SpawnSystem : MonoBehaviour { private static CFX_SpawnSystem instance; public GameObject[] objectsToPreload = (GameObject[])(object)new GameObject[0]; public int[] objectsToPreloadTimes = new int[0]; public bool hideObjectsInHierarchy = false; public bool spawnAsChildren = true; public bool onlyGetInactiveObjects = false; public bool instantiateIfNeeded = false; private bool allObjectsLoaded; private Dictionary> instantiatedObjects = new Dictionary>(); private Dictionary poolCursors = new Dictionary(); public static bool AllObjectsLoaded => instance.allObjectsLoaded; public static GameObject GetNextObject(GameObject sourceObj, bool activateObject = true) { int instanceID = ((Object)sourceObj).GetInstanceID(); if (!instance.poolCursors.ContainsKey(instanceID)) { Debug.LogError((object)("[CFX_SpawnSystem.GetNextObject()] Object hasn't been preloaded: " + ((Object)sourceObj).name + " (ID:" + instanceID + ")\n"), (Object)(object)instance); return null; } int num = instance.poolCursors[instanceID]; GameObject val = null; if (instance.onlyGetInactiveObjects) { int num2 = num; while (true) { val = instance.instantiatedObjects[instanceID][num]; instance.increasePoolCursor(instanceID); num = instance.poolCursors[instanceID]; if ((Object)(object)val != (Object)null && !val.activeSelf) { break; } if (num == num2) { if (instance.instantiateIfNeeded) { Debug.Log((object)("[CFX_SpawnSystem.GetNextObject()] A new instance has been created for \"" + ((Object)sourceObj).name + "\" because no active instance were found in the pool.\n"), (Object)(object)instance); PreloadObject(sourceObj); List list = instance.instantiatedObjects[instanceID]; val = list[list.Count - 1]; break; } Debug.LogWarning((object)("[CFX_SpawnSystem.GetNextObject()] There are no active instances available in the pool for \"" + ((Object)sourceObj).name + "\"\nYou may need to increase the preloaded object count for this prefab?"), (Object)(object)instance); return null; } } } else { val = instance.instantiatedObjects[instanceID][num]; instance.increasePoolCursor(instanceID); } if (activateObject && (Object)(object)val != (Object)null) { val.SetActive(true); } return val; } public static void PreloadObject(GameObject sourceObj, int poolSize = 1) { instance.addObjectToPool(sourceObj, poolSize); } public static void UnloadObjects(GameObject sourceObj) { instance.removeObjectsFromPool(sourceObj); } private void addObjectToPool(GameObject sourceObject, int number) { int instanceID = ((Object)sourceObject).GetInstanceID(); if (!instantiatedObjects.ContainsKey(instanceID)) { instantiatedObjects.Add(instanceID, new List()); poolCursors.Add(instanceID, 0); } for (int i = 0; i < number; i++) { GameObject val = Object.Instantiate(sourceObject); val.SetActive(false); CFX_AutoDestructShuriken[] componentsInChildren = val.GetComponentsInChildren(true); CFX_AutoDestructShuriken[] array = componentsInChildren; foreach (CFX_AutoDestructShuriken cFX_AutoDestructShuriken in array) { cFX_AutoDestructShuriken.OnlyDeactivate = true; } CFX_LightIntensityFade[] componentsInChildren2 = val.GetComponentsInChildren(true); CFX_LightIntensityFade[] array2 = componentsInChildren2; foreach (CFX_LightIntensityFade cFX_LightIntensityFade in array2) { cFX_LightIntensityFade.autodestruct = false; } instantiatedObjects[instanceID].Add(val); if (hideObjectsInHierarchy) { ((Object)val).hideFlags = (HideFlags)1; } if (spawnAsChildren) { val.transform.parent = ((Component)this).transform; } } } private void removeObjectsFromPool(GameObject sourceObject) { int instanceID = ((Object)sourceObject).GetInstanceID(); if (!instantiatedObjects.ContainsKey(instanceID)) { Debug.LogWarning((object)("[CFX_SpawnSystem.removeObjectsFromPool()] There aren't any preloaded object for: " + ((Object)sourceObject).name + " (ID:" + instanceID + ")\n"), (Object)(object)((Component)this).gameObject); return; } for (int num = instantiatedObjects[instanceID].Count - 1; num >= 0; num--) { GameObject val = instantiatedObjects[instanceID][num]; instantiatedObjects[instanceID].RemoveAt(num); Object.Destroy((Object)(object)val); } instantiatedObjects.Remove(instanceID); poolCursors.Remove(instanceID); } private void increasePoolCursor(int uniqueId) { instance.poolCursors[uniqueId]++; if (instance.poolCursors[uniqueId] >= instance.instantiatedObjects[uniqueId].Count) { instance.poolCursors[uniqueId] = 0; } } private void Awake() { if ((Object)(object)instance != (Object)null) { Debug.LogWarning((object)"CFX_SpawnSystem: There should only be one instance of CFX_SpawnSystem per Scene!\n", (Object)(object)((Component)this).gameObject); } instance = this; } private void Start() { allObjectsLoaded = false; for (int i = 0; i < objectsToPreload.Length; i++) { PreloadObject(objectsToPreload[i], objectsToPreloadTimes[i]); } allObjectsLoaded = true; } } namespace Billiam_J_McHooligan.Nanjing_1900_Warlord_Pistol; [BepInPlugin("Billiam_J_McHooligan.Nanjing_1900_Warlord_Pistol", "Nanjing_1900_Warlord_Pistol", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class Nanjing_1900_Warlord_PistolPlugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; LoadAssets(); } private void LoadAssets() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Billiam_J_McHooligan.Nanjing_1900_Warlord_Pistol"); OtherLoader.RegisterDirectLoad(BasePath, "Billiam_J_McHooligan.Nanjing_1900_Warlord_Pistol", "", "", "nanjing1900", ""); } } public class MuseumActivateSosig : MonoBehaviour { public MuseumManager manager; public bool buttonPressed; public AudioSource clickAudio; private void OnTriggerEnter(Collider collider) { if (!buttonPressed && ((Component)collider).gameObject.tag == "GameController") { ClickButton(); buttonPressed = true; } } private void OnTriggerExit(Collider collider) { if (((Component)collider).gameObject.tag == "GameController") { buttonPressed = false; } } private void ClickButton() { if (manager.museumSetups[manager._spawnedIndex].isSpawned) { manager.WakeSosigs(); clickAudio.Play(); } } } public class MuseumManager : MonoBehaviour { public int startingSetupIndex; public MuseumSetup[] museumSetups; [HideInInspector] public int _setupIndex; [HideInInspector] public int _spawnedIndex; private List activeSosigs = new List(); public void Start() { _setupIndex = startingSetupIndex; UpdateVis(); } public void CycleSetupForward() { _setupIndex = (_setupIndex + 1) % museumSetups.Length; if (!TryGetValidSetup(museumSetups[_setupIndex])) { CycleSetupForward(); } else { UpdateVis(); } } public void CycleSetupBackward() { _setupIndex = (_setupIndex - 1 + museumSetups.Length) % museumSetups.Length; if (!TryGetValidSetup(museumSetups[_setupIndex])) { CycleSetupBackward(); } else { UpdateVis(); } } public void ResetSosigs() { DespawnActiveSosigs(); SpawnSosigs(); } public void WakeSosigs() { foreach (Sosig activeSosig in activeSosigs) { activeSosig.SetCurrentOrder((SosigOrder)7); } } public void LoadSetup() { MuseumSetup museumSetup = museumSetups[_setupIndex]; if (museumSetups[_spawnedIndex].isSpawned) { DespawnSetup(); } if (!museumSetup.isSpawned) { if (!string.IsNullOrEmpty(museumSetup.fileName) && !string.IsNullOrEmpty(museumSetup.pluginDictionaryString)) { PreloadSceneFile(museumSetup.pluginDictionaryString, museumSetup.fileName); } else { Debug.Log((object)("No file name or plugin dictionary string found for setup index: " + _setupIndex)); } if (museumSetup.dioramaSosigs != null) { SpawnSosigs(); } else { Debug.Log((object)("Failed to find any sosigs to spawn for setup index:" + _setupIndex)); } UpdateVis(); museumSetup.isSpawned = true; _spawnedIndex = _setupIndex; } else { Debug.Log((object)"Uhh whoops, tried to spawn an already active setup somehow?"); } } public void UpdateVis() { MuseumSetup[] array = museumSetups; foreach (MuseumSetup museumSetup in array) { museumSetup.displayObject.SetActive(false); } museumSetups[_setupIndex].displayObject.SetActive(true); } public void DespawnSetup() { DespawnActiveSosigs(); museumSetups[_spawnedIndex].isSpawned = false; } public void DespawnActiveSosigs() { for (int i = 0; i < activeSosigs.Count; i++) { if ((Object)(object)activeSosigs[i] != (Object)null) { activeSosigs[i].ClearSosig(); } } activeSosigs.Clear(); } public bool TryGetValidSetup(MuseumSetup setup) { return Chainloader.PluginInfos.ContainsKey(setup.pluginDictionaryString); } public void PreloadSceneFile(string PluginDictionaryString, string FileName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown PluginInfo value = new PluginInfo(); Chainloader.PluginInfos.TryGetValue(PluginDictionaryString, out value); string directoryName = Path.GetDirectoryName(value.Location); VaultFile val = new VaultFile(); Load(Path.Combine(directoryName, FileName), val); ((MonoBehaviour)this).StartCoroutine(LoadVaultFile(val)); } public void Load(string path, T objectToOverwrite) { string empty = string.Empty; Debug.Log((object)path); JsonUtility.FromJsonOverwrite(File.ReadAllText(path), (object)objectToOverwrite); } private IEnumerator LoadVaultFile(VaultFile FileToSpawn) { yield return (object)new WaitForSeconds(1f); string text = default(string); VaultSystem.SpawnObjects((VaultFileDisplayMode)2, FileToSpawn, ref text, (Transform)null, Vector3.zero); } public void SpawnSosigs() { DioramaSosig[] dioramaSosigs = museumSetups[_setupIndex].dioramaSosigs; foreach (DioramaSosig dioramaSosig in dioramaSosigs) { if (dioramaSosig != null) { SpawnDioramaSosig(dioramaSosig); } } } public void SpawnDioramaSosig(DioramaSosig sos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0009: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) SpawnOptions val = new SpawnOptions(); val.SpawnState = sos.spawnState; val.SpawnActivated = sos.spawnActive; val.EquipmentMode = sos.equipmentMode; val.SpawnWithFullAmmo = sos.spawnWithFullAmmo; val.IFF = sos.iFF; val.SosigTargetPosition = sos.spawnLocation.position; val.SosigTargetRotation = sos.spawnLocation.eulerAngles; SpawnOptions val2 = val; Sosig val3 = new Sosig(); val3 = ((!sos.usesCustomSosigID) ? SosigAPI.Spawn(ManagerSingleton.Instance.odicSosigObjsByID[sos.vanillaSosigType], val2, sos.spawnLocation.position, sos.spawnLocation.rotation) : SosigAPI.Spawn(ManagerSingleton.Instance.odicSosigObjsByID[(SosigEnemyID)sos.customSosigID], val2, sos.spawnLocation.position, sos.spawnLocation.rotation)); activeSosigs.Add(val3); val3.IgnoresNeedForWeapons = sos.ignoresNeedForWeapon; if (sos.doesPath) { List list = new List(); List list2 = new List(); list = sos.pathPoints.Select((Transform t) => t.position).ToList(); list2 = sos.pathPoints.Select((Transform t) => t.eulerAngles).ToList(); val3.CommandPathTo(list, list2, 1f, Vector2.one * 4f, 2f, sos.pathingMoveSpeed, sos.pathingLoopType, (List)null, 0.2f, 1f, sos.pathingIsPatrol, 50f); } } } [Serializable] public class MuseumSetup { [HideInInspector] public bool isSpawned; public string fileName; public string pluginDictionaryString; public DioramaSosig[] dioramaSosigs; public GameObject displayObject; } [Serializable] public class DioramaSosig { public Transform spawnLocation; [Tooltip("Vanilla sosigs already built in")] public SosigEnemyID vanillaSosigType; [Tooltip("Will ignore the vanilla sosig input when enabled")] public bool usesCustomSosigID = false; [Tooltip("For using sosig IDs for packer's custom sosig loader")] public int customSosigID = 0; [Header("Sosig Options")] [Tooltip("The IFF of this sosig")] public int iFF = 0; [Tooltip("Whether this sosig spawns with its AI enabled or not")] public bool spawnActive = false; [Tooltip("The state this sosig spawns in")] public SosigOrder spawnState = (SosigOrder)9; [Tooltip("What equipment this sosig is allowed to spawn with (eg: if you use only primary, this sosig wont spawn with any other gear it otherwise could spawn with)")] public EquipmentSlots equipmentMode = (EquipmentSlots)7; [Tooltip("I honestly dont know what happens if you disable this, use at your own peril")] public bool spawnWithFullAmmo = true; [Tooltip("Enable this if this sosig is supposed to be passive otherwise they'll immediately start trying to find a gun and cowering")] public bool ignoresNeedForWeapon = false; [Header("Pathing Options")] [Tooltip("Enable if you want this sosig to follow a path (eg: patrol or wander). Leave disabled if you want your sosig to stay where they spawn unless otherwise agrod")] public bool doesPath = false; [Tooltip("The points this sosig paths between")] public Transform[] pathPoints; [Tooltip("The speed this sosig paths between points")] public SosigMoveSpeed pathingMoveSpeed = (SosigMoveSpeed)3; [Tooltip("The behavior this sosig uses when looping through the pathing points")] public PathLoopType pathingLoopType = (PathLoopType)4; [Tooltip("Honestly, I forgot what this does, play with it and see lol")] public bool pathingIsPatrol = true; } public class MuseumResetSosig : MonoBehaviour { public MuseumManager manager; public bool buttonPressed; public AudioSource clickAudio; private void OnTriggerEnter(Collider collider) { if (!buttonPressed && ((Component)collider).gameObject.tag == "GameController") { ClickButton(); buttonPressed = true; } } private void OnTriggerExit(Collider collider) { if (((Component)collider).gameObject.tag == "GameController") { buttonPressed = false; } } private void ClickButton() { if (manager.museumSetups[manager._spawnedIndex].isSpawned) { manager.ResetSosigs(); clickAudio.Play(); } } } public class TSR_Configurable_Course : MonoBehaviour { [Header("Course Setup")] [Tooltip("The courses to cycle through")] public TSR_Course[] courses; [Tooltip("The names of each course (name 1 goes to course 1 and so on)")] public string[] courseNames; [Tooltip("Game Object to enable whenever its corresponding course is selected (and disabled when another course is swapped to)")] public GameObject[] courseGameObjects; [Tooltip("The default course that is selected")] public int defaultCourseIndex; [Header("Objects")] [Tooltip("UI that the name of the current course is displayed to")] public Text currentCourseNameDisplay; [HideInInspector] public int courseIndex; private void Start() { courseIndex = defaultCourseIndex; UpdateVis(); } public void CycleCourseFoward() { bool flag = false; if (courses[courseIndex].isTargetsActive) { courses[courseIndex].SpawnTargets(); flag = true; } courseIndex = (courseIndex + 1) % courses.Length; if (flag) { courses[courseIndex].SpawnTargets(); } UpdateVis(); } public void CycleCourseBackward() { bool flag = false; if (courses[courseIndex].isTargetsActive) { courses[courseIndex].SpawnTargets(); flag = true; } courseIndex = (courseIndex - 1) % courses.Length; if (flag) { courses[courseIndex].SpawnTargets(); } UpdateVis(); } public void UpdateVis() { if ((Object)(object)currentCourseNameDisplay != (Object)null && courseNames[courseIndex] != null) { currentCourseNameDisplay.text = courseNames[courseIndex]; } if (courseGameObjects != null) { GameObject[] array = courseGameObjects; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(false); } } } if (courseGameObjects != null && (Object)(object)courseGameObjects[courseIndex] != (Object)null) { courseGameObjects[courseIndex].SetActive(true); } } } public class TSR_Course : MonoBehaviour { [Header("Target Setter/Resetter Setup")] [Tooltip("Array of targets")] public TSR_Target[] targets; [Tooltip("Total ammount of targets to spawn (leave -1 to spawn all targets)")] public int targetsToSpawn = -1; [Tooltip("Whether this button and its targets are enabled or disabled whenever the map starts")] public bool isTargetsEnabledAtStart; [Tooltip("Game Object thats enabled whenever the targets are turned on")] public GameObject enabledVis; [Tooltip("Game Object thats enabled whenever the targets are turned off")] public GameObject disabledVis; [HideInInspector] public bool isTargetsActive; [HideInInspector] public FVRObject mainObject; [HideInInspector] public List allTargets = new List(); [HideInInspector] public List activeSosigs = new List(); [HideInInspector] public bool buttonPressed; [HideInInspector] public List externalButtons = new List(); private void Start() { for (int i = 0; i < targets.Length; i++) { for (int num = ((Component)targets[i]).transform.childCount - 1; num >= 0; num--) { ((Component)((Component)targets[i]).transform.GetChild(num)).gameObject.SetActive(false); } } if (isTargetsEnabledAtStart) { SpawnTargets(); } else if (!isTargetsEnabledAtStart) { isTargetsActive = false; UpdateVis(); } } public void ResetTargets() { if (!isTargetsActive || !isTargetsActive) { return; } for (int i = 0; i < allTargets.Count; i++) { if ((Object)(object)allTargets[i] != (Object)null) { Object.Destroy((Object)(object)allTargets[i]); } } allTargets.Clear(); for (int j = 0; j < activeSosigs.Count; j++) { if ((Object)(object)activeSosigs[j] != (Object)null) { activeSosigs[j].ClearSosig(); } } activeSosigs.Clear(); TSR_Target[] array = targets; foreach (TSR_Target tSR_Target in array) { tSR_Target.isActive = false; } if (targetsToSpawn < 0 || targetsToSpawn > targets.Length) { for (int l = 0; l < targets.Length; l++) { SpawnTarget(targets[l]); } return; } int num = 0; while (num < targetsToSpawn) { int num2 = Random.Range(0, targets.Length); TSR_Target tSR_Target2 = targets[num2]; if (!tSR_Target2.isActive) { SpawnTarget(tSR_Target2); num++; } } } public void SpawnTargets() { if (!isTargetsActive) { if (targets != null) { if (targetsToSpawn < 0 || targetsToSpawn > targets.Length) { for (int i = 0; i < targets.Length; i++) { SpawnTarget(targets[i]); } } else { int num = 0; while (num < targetsToSpawn) { int num2 = Random.Range(0, targets.Length); TSR_Target tSR_Target = targets[num2]; if (!tSR_Target.isActive) { SpawnTarget(tSR_Target); num++; } } } } isTargetsActive = true; UpdateVis(); } else { if (!isTargetsActive) { return; } if (allTargets != null) { for (int j = 0; j < allTargets.Count; j++) { if ((Object)(object)allTargets[j] != (Object)null) { Object.Destroy((Object)(object)allTargets[j]); } } allTargets.Clear(); } if (activeSosigs != null) { for (int k = 0; k < activeSosigs.Count; k++) { if ((Object)(object)activeSosigs[k] != (Object)null) { activeSosigs[k].ClearSosig(); } } activeSosigs.Clear(); } if (targets != null) { TSR_Target[] array = targets; foreach (TSR_Target tSR_Target2 in array) { tSR_Target2.isActive = false; } } isTargetsActive = false; UpdateVis(); } } public void SpawnTarget(TSR_Target target) { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) if (Random.Range(0f, 1f) > target.spawnChance) { return; } int num = 0; if (target.mixedTargets.Count <= 0) { return; } num = Random.Range(0, target.mixedTargets.Count); target.isActive = true; if (target.mixedTargets[num] is string) { string key = (string)target.mixedTargets[num]; if (IM.OD.TryGetValue(key, out mainObject)) { GameObject val = Object.Instantiate(((AnvilAsset)mainObject).GetGameObject(), ((Component)target).transform.position, ((Component)target).transform.rotation); allTargets.Add(val); if (target.isPhysicsLocked) { PhysLock(val); } } } else if (target.mixedTargets[num] is GameObject) { GameObject val2 = (GameObject)target.mixedTargets[num]; GameObject val3 = Object.Instantiate(val2, ((Component)target).transform.position, ((Component)target).transform.rotation); allTargets.Add(val3); if (target.isPhysicsLocked) { PhysLock(val3); } val3.SetActive(true); } else { if (!(target.mixedTargets[num] is TSR_Target_Sosig)) { return; } TSR_Target_Sosig tSR_Target_Sosig = (TSR_Target_Sosig)target.mixedTargets[num]; SpawnOptions val4 = new SpawnOptions(); val4.SpawnState = tSR_Target_Sosig.spawnState; val4.SpawnActivated = tSR_Target_Sosig.spawnActive; val4.EquipmentMode = tSR_Target_Sosig.equipmentMode; val4.SpawnWithFullAmmo = tSR_Target_Sosig.spawnWithFullAmmo; val4.IFF = tSR_Target_Sosig.iFF; val4.SosigTargetPosition = ((Component)target).transform.position; val4.SosigTargetRotation = ((Component)target).transform.eulerAngles; SpawnOptions val5 = val4; Sosig val6 = new Sosig(); val6 = ((!tSR_Target_Sosig.usesCustomSosigID) ? SosigAPI.Spawn(ManagerSingleton.Instance.odicSosigObjsByID[tSR_Target_Sosig.vanillaSosigType], val5, ((Component)target).transform.position, ((Component)target).transform.rotation) : SosigAPI.Spawn(ManagerSingleton.Instance.odicSosigObjsByID[(SosigEnemyID)tSR_Target_Sosig.customSosigID], val5, ((Component)target).transform.position, ((Component)target).transform.rotation)); activeSosigs.Add(val6); val6.IgnoresNeedForWeapons = tSR_Target_Sosig.ignoresNeedForWeapon; if (tSR_Target_Sosig.doesPath) { List list = new List(); List list2 = new List(); list = tSR_Target_Sosig.pathPoints.Select((Transform t) => t.position).ToList(); list2 = tSR_Target_Sosig.pathPoints.Select((Transform t) => t.eulerAngles).ToList(); val6.CommandPathTo(list, list2, 1f, Vector2.one * 4f, 2f, tSR_Target_Sosig.pathingMoveSpeed, tSR_Target_Sosig.pathingLoopType, (List)null, 0.2f, 1f, tSR_Target_Sosig.pathingIsPatrol, 50f); } } } public void PhysLock(GameObject obj) { Rigidbody component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } } public void UpdateVis() { if (isTargetsActive) { if ((Object)(object)enabledVis != (Object)null) { enabledVis.SetActive(true); } if ((Object)(object)disabledVis != (Object)null) { disabledVis.SetActive(false); } } else { if ((Object)(object)enabledVis != (Object)null) { enabledVis.SetActive(false); } if ((Object)(object)disabledVis != (Object)null) { disabledVis.SetActive(true); } } externalButtons.ForEach(delegate(TSR_ExternalButton b) { b.UpdateVis(); }); } private void OnTriggerEnter(Collider collider) { if (!buttonPressed && ((Component)collider).gameObject.tag == "GameController") { SpawnTargets(); buttonPressed = true; } } private void OnTriggerExit(Collider collider) { if (((Component)collider).gameObject.tag == "GameController") { buttonPressed = false; } } } public class TSR_Course_Linker : MonoBehaviour { public TSR_Course[] normalCourses; public TSR_Configurable_Course[] configurableCourses; [Tooltip("Whether this button and its targets are enabled or disabled whenever the map starts")] public bool isCoursesEnabledAtStart; [Tooltip("Game Object thats enabled whenever the targets are turned on")] public GameObject enabledVis; [Tooltip("Game Object thats enabled whenever the targets are turned off")] public GameObject disabledVis; [HideInInspector] public bool isCoursesActive; [HideInInspector] public List externalButtons = new List(); [HideInInspector] public bool buttonPressed; public void StartCourses() { if (normalCourses != null) { TSR_Course[] array = normalCourses; foreach (TSR_Course tSR_Course in array) { tSR_Course.SpawnTargets(); } } if (configurableCourses != null) { TSR_Configurable_Course[] array2 = configurableCourses; foreach (TSR_Configurable_Course tSR_Configurable_Course in array2) { tSR_Configurable_Course.courses[tSR_Configurable_Course.courseIndex].SpawnTargets(); } } isCoursesActive = true; UpdateVis(); } public void ResetCourses() { if (normalCourses != null) { TSR_Course[] array = normalCourses; foreach (TSR_Course tSR_Course in array) { tSR_Course.ResetTargets(); } } if (configurableCourses != null) { TSR_Configurable_Course[] array2 = configurableCourses; foreach (TSR_Configurable_Course tSR_Configurable_Course in array2) { tSR_Configurable_Course.courses[tSR_Configurable_Course.courseIndex].ResetTargets(); } } } public void UpdateVis() { if (isCoursesActive) { if ((Object)(object)enabledVis != (Object)null) { enabledVis.SetActive(true); } if ((Object)(object)disabledVis != (Object)null) { disabledVis.SetActive(false); } } else { if ((Object)(object)enabledVis != (Object)null) { enabledVis.SetActive(false); } if ((Object)(object)disabledVis != (Object)null) { disabledVis.SetActive(true); } } externalButtons.ForEach(delegate(TSR_ExternalButton b) { b.UpdateVis(); }); } private void OnTriggerEnter(Collider collider) { if (!buttonPressed && ((Component)collider).gameObject.tag == "GameController") { StartCourses(); buttonPressed = true; } } private void OnTriggerExit(Collider collider) { if (((Component)collider).gameObject.tag == "GameController") { buttonPressed = false; } } } public class TSR_ExternalButton : MonoBehaviour { public TSR_Course mainButton; public bool isLinkedCourseButton; public TSR_Course_Linker mainLinkedCourse; public bool isResetButton; public AudioSource resetAudio; [Tooltip("Game Object thats enabled whenever the targets are turned on")] public GameObject enabledVis; [Tooltip("Game Object thats enabled whenever the targets are turned off")] public GameObject disabledVis; [HideInInspector] public bool buttonPressed; private void Start() { if ((Object)(object)mainButton != (Object)null) { mainButton.externalButtons.Add(this); } if ((Object)(object)mainLinkedCourse != (Object)null) { mainLinkedCourse.externalButtons.Add(this); } UpdateVis(); } public void UpdateVis() { if (((Object)(object)mainButton != (Object)null && mainButton.isTargetsActive) || ((Object)(object)mainLinkedCourse != (Object)null && mainLinkedCourse.isCoursesActive)) { if ((Object)(object)enabledVis != (Object)null) { enabledVis.SetActive(true); } if ((Object)(object)disabledVis != (Object)null) { disabledVis.SetActive(false); } } else { if ((Object)(object)enabledVis != (Object)null) { enabledVis.SetActive(false); } if ((Object)(object)disabledVis != (Object)null) { disabledVis.SetActive(true); } } } private void OnTriggerEnter(Collider collider) { if (!buttonPressed && ((Component)collider).gameObject.tag == "GameController") { ClickButton(); buttonPressed = true; } } public void ClickButton() { if (isResetButton && !isLinkedCourseButton && mainButton.isTargetsActive) { mainButton.ResetTargets(); resetAudio.Play(); } else if (isResetButton && isLinkedCourseButton && mainLinkedCourse.isCoursesActive) { mainLinkedCourse.ResetCourses(); resetAudio.Play(); } else if (!isLinkedCourseButton && !isResetButton) { mainButton.SpawnTargets(); } else if (isLinkedCourseButton && !isResetButton) { mainLinkedCourse.StartCourses(); } } private void OnTriggerExit(Collider collider) { if (((Component)collider).gameObject.tag == "GameController") { buttonPressed = false; } } } public class TSR_Target : MonoBehaviour { [Header("Target Setup")] [Tooltip("Spawn this object ID at this transform")] public string[] itemID; [Tooltip("Spawn a custom prefab at this transform")] public GameObject[] targetPrefab; [Tooltip("Spawn a custom or vanilla sosig at this transform")] public TSR_Target_Sosig[] sosig; [Tooltip("Makes sure the object that is spawned is unable to be affected by physics (by checking for rigidbodies and making them kinematic)")] public bool isPhysicsLocked; [Tooltip("Chance this target spawns when called on (0-1)")] [Range(0f, 1f)] public float spawnChance = 1f; [HideInInspector] public List mixedTargets = new List(); [HideInInspector] public bool isActive; private void Start() { mixedTargets.AddRange(itemID); mixedTargets.AddRange(targetPrefab); mixedTargets.AddRange(sosig); } private void OnDrawGizmos() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if ((itemID != null && itemID.Length > 0) || (targetPrefab != null && targetPrefab.Length > 0) || (sosig != null && sosig.Length > 0)) { Gizmos.color = Color.yellow; Gizmos.DrawSphere(((Component)this).transform.position, 0.1f); Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + ((Component)this).transform.forward * 0.25f); } else { Gizmos.color = Color.gray; Gizmos.DrawSphere(((Component)this).gameObject.transform.position, 0.1f); Gizmos.DrawLine(((Component)this).gameObject.transform.position, ((Component)this).gameObject.transform.position + ((Component)this).gameObject.transform.forward * 0.25f); } if (isPhysicsLocked) { Gizmos.color = Color.green; Gizmos.DrawWireSphere(((Component)this).gameObject.transform.position, 0.11f); } } } [Serializable] public class TSR_Target_Sosig { [Tooltip("Vanilla sosigs already built in")] public SosigEnemyID vanillaSosigType; [Tooltip("Will ignore the vanilla sosig input when enabled")] public bool usesCustomSosigID = false; [Tooltip("For using sosig IDs for packer's custom sosig loader")] public int customSosigID = 0; [Header("Sosig Options")] [Tooltip("The IFF of this sosig")] public int iFF = 0; [Tooltip("Whether this sosig spawns with its AI enabled or not")] public bool spawnActive = true; [Tooltip("The state this sosig spawns in")] public SosigOrder spawnState = (SosigOrder)9; [Tooltip("What equipment this sosig is allowed to spawn with (eg: if you use only primary, this sosig wont spawn with any other gear it otherwise could spawn with)")] public EquipmentSlots equipmentMode = (EquipmentSlots)7; [Tooltip("I honestly dont know what happens if you disable this, use at your own peril")] public bool spawnWithFullAmmo = true; [Tooltip("Enable this if this sosig is supposed to be passive otherwise they'll immediately start trying to find a gun and cowering")] public bool ignoresNeedForWeapon = false; [Header("Pathing Options")] [Tooltip("Enable if you want this sosig to follow a path (eg: patrol or wander). Leave disabled if you want your sosig to stay where they spawn unless otherwise agrod")] public bool doesPath = false; [Tooltip("The points this sosig paths between")] public Transform[] pathPoints; [Tooltip("The speed this sosig paths between points")] public SosigMoveSpeed pathingMoveSpeed = (SosigMoveSpeed)3; [Tooltip("The behavior this sosig uses when looping through the pathing points")] public PathLoopType pathingLoopType = (PathLoopType)4; [Tooltip("Honestly, I forgot what this does, play with it and see lol")] public bool pathingIsPatrol = true; } public enum ControlMode { simple = 1, touch } public class VehicleControl : MonoBehaviour { [Serializable] public class CarWheels { public ConnectWheel wheels; } [Serializable] public class ConnectWheel { public bool frontWheelDrive = true; public Transform frontRight; public Transform frontLeft; public WheelSetting frontSetting; public bool backWheelDrive = true; public Transform backRight; public Transform backLeft; public WheelSetting rearSetting; } [Serializable] public class WheelSetting { public float Radius = 0.4f; public float Weight = 1000f; public float Distance = 0.2f; } [Serializable] public class CarLights { public Light[] brakeLights; public Light[] reverseLights; } [Serializable] public class CarSounds { public AudioSource IdleEngine; public AudioSource LowEngine; public AudioSource HighEngine; public float minPitch = 1f; public float maxPitch = 10f; public AudioSource nitro; public AudioSource switchGear; } [Serializable] public class CarParticles { public GameObject brakeParticlePerfab; public ParticleSystem shiftParticle1; public ParticleSystem shiftParticle2; private GameObject[] wheelParticle = (GameObject[])(object)new GameObject[4]; } [Serializable] public class CarSetting { public bool showNormalGizmos = false; public Transform carSteer; public HitGround[] hitGround; public List cameraSwitchView; public float springs = 25000f; public float dampers = 1500f; public float carPower = 120f; public float shiftPower = 150f; public float brakePower = 8000f; public Vector3 shiftCentre = new Vector3(0f, -0.8f, 0f); public float maxSteerAngle = 25f; public float shiftDownRPM = 1500f; public float shiftUpRPM = 2500f; public float idleRPM = 500f; public float stiffness = 2f; public bool automaticGear = true; public float[] gears = new float[6] { -10f, 9f, 6f, 4.5f, 3f, 2.5f }; public float LimitBackwardSpeed = 60f; public float LimitForwardSpeed = 220f; } [Serializable] public class HitGround { public string tag = "street"; public bool grounded = false; public AudioClip brakeSound; public AudioClip groundSound; public Color brakeColor; } private class WheelComponent { public Transform wheel; public WheelCollider collider; public Vector3 startPos; public float rotation = 0f; public float rotation2 = 0f; public float maxSteer; public bool drive; public float pos_y = 0f; public WheelSetting settings; } public ControlMode controlMode = ControlMode.simple; public bool activeControl = false; public CarWheels carWheels; public CarLights carLights; public CarSounds carSounds; public CarParticles carParticles; public CarSetting carSetting; [HideInInspector] public float steer = 0f; [HideInInspector] public float accel = 0f; [HideInInspector] public bool brake; private bool shifmotor; [HideInInspector] public float curTorque = 100f; [HideInInspector] public float powerShift = 100f; [HideInInspector] public bool shift; private float torque = 100f; [HideInInspector] public float speed = 0f; private float lastSpeed = -10f; private bool shifting = false; private float[] efficiencyTable = new float[22] { 0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1f, 0.95f, 0.8f, 0.7f, 0.6f, 0.5f, 0.45f, 0.4f, 0.36f, 0.33f, 0.3f, 0.2f, 0.1f, 0.05f }; private float efficiencyTableStep = 250f; private float Pitch; private float PitchDelay; private float shiftTime = 0f; private float shiftDelay = 0f; [HideInInspector] public int currentGear = 0; [HideInInspector] public bool NeutralGear = true; [HideInInspector] public float motorRPM = 0f; [HideInInspector] public bool Backward = false; [HideInInspector] public float accelFwd = 0f; [HideInInspector] public float accelBack = 0f; [HideInInspector] public float steerAmount = 0f; private float wantedRPM = 0f; private float w_rotate; private float slip; private float slip2 = 0f; private GameObject[] Particle = (GameObject[])(object)new GameObject[4]; private Vector3 steerCurAngle; private Rigidbody myRigidbody; private WheelComponent[] wheels; public bool isOn = true; public bool isForciblyOff = false; private WheelComponent SetWheelComponent(Transform wheel, float maxSteer, bool drive, float pos_y, WheelSetting setting) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) WheelComponent wheelComponent = new WheelComponent(); GameObject val = new GameObject(((Object)wheel).name + "WheelCollider"); val.transform.parent = ((Component)this).transform; val.transform.position = wheel.position; val.transform.eulerAngles = ((Component)this).transform.eulerAngles; pos_y = val.transform.localPosition.y; WheelCollider val2 = (WheelCollider)val.AddComponent(typeof(WheelCollider)); wheelComponent.wheel = wheel; wheelComponent.collider = val.GetComponent(); wheelComponent.drive = drive; wheelComponent.pos_y = pos_y; wheelComponent.maxSteer = maxSteer; wheelComponent.startPos = val.transform.localPosition; wheelComponent.settings = setting; return wheelComponent; } private void Awake() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) if (carSetting.automaticGear) { NeutralGear = false; } myRigidbody = ((Component)((Component)this).transform).GetComponent(); wheels = new WheelComponent[4]; wheels[0] = SetWheelComponent(carWheels.wheels.frontRight, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontRight.position.y, carWheels.wheels.frontSetting); wheels[1] = SetWheelComponent(carWheels.wheels.frontLeft, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontLeft.position.y, carWheels.wheels.frontSetting); wheels[2] = SetWheelComponent(carWheels.wheels.backRight, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backRight.position.y, carWheels.wheels.rearSetting); wheels[3] = SetWheelComponent(carWheels.wheels.backLeft, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backLeft.position.y, carWheels.wheels.rearSetting); if (Object.op_Implicit((Object)(object)carSetting.carSteer)) { steerCurAngle = carSetting.carSteer.localEulerAngles; } WheelComponent[] array = wheels; foreach (WheelComponent wheelComponent in array) { WheelCollider collider = wheelComponent.collider; collider.suspensionDistance = wheelComponent.settings.Distance; JointSpring suspensionSpring = collider.suspensionSpring; suspensionSpring.spring = carSetting.springs; suspensionSpring.damper = carSetting.dampers; collider.suspensionSpring = suspensionSpring; collider.radius = wheelComponent.settings.Radius; collider.mass = wheelComponent.settings.Weight; WheelFrictionCurve val = collider.forwardFriction; ((WheelFrictionCurve)(ref val)).asymptoteValue = 5000f; ((WheelFrictionCurve)(ref val)).extremumSlip = 2f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 20f; ((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness; collider.forwardFriction = val; val = collider.sidewaysFriction; ((WheelFrictionCurve)(ref val)).asymptoteValue = 7500f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 2f; ((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness; collider.sidewaysFriction = val; } } public void TurnOnEngine(bool forcibly) { if (!isForciblyOff) { isOn = true; } else if (forcibly) { isForciblyOff = false; isOn = true; } } public void TurnOffEngine(bool forcibly) { isForciblyOff = forcibly; isOn = false; } public void ShiftTo(int newGear) { ((Component)carSounds.switchGear).GetComponent().Play(); currentGear = newGear; if (currentGear == 0) { NeutralGear = true; } else { NeutralGear = false; } if (currentGear == -1) { currentGear = 0; } } public void ShiftUp(bool ignoreDelay) { float timeSinceLevelLoad = Time.timeSinceLevelLoad; if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || currentGear >= carSetting.gears.Length - 1) { return; } ((Component)carSounds.switchGear).GetComponent().Play(); if (!carSetting.automaticGear) { if (currentGear == 0) { if (NeutralGear) { currentGear++; NeutralGear = false; } else { NeutralGear = true; } } else { currentGear++; } } else { currentGear++; } shiftDelay = timeSinceLevelLoad + 1f; shiftTime = 1.5f; } public void ShiftDown(bool ignoreDelay) { float timeSinceLevelLoad = Time.timeSinceLevelLoad; if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || (currentGear <= 0 && !NeutralGear)) { return; } ((Component)carSounds.switchGear).GetComponent().Play(); if (!carSetting.automaticGear) { if (currentGear == 1) { if (!NeutralGear) { currentGear--; NeutralGear = true; } } else if (currentGear == 0) { NeutralGear = false; } else { currentGear--; } } else { currentGear--; } shiftDelay = timeSinceLevelLoad + 0.1f; shiftTime = 2f; } private void OnCollisionEnter(Collision collision) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent())) { VehicleControl component = ((Component)collision.transform.root).GetComponent(); Vector3 relativeVelocity = collision.relativeVelocity; component.slip2 = Mathf.Clamp(((Vector3)(ref relativeVelocity)).magnitude, 0f, 10f); myRigidbody.angularVelocity = new Vector3((0f - myRigidbody.angularVelocity.x) * 0.5f, myRigidbody.angularVelocity.y * 0.5f, (0f - myRigidbody.angularVelocity.z) * 0.5f); myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, myRigidbody.velocity.y * 0.5f, myRigidbody.velocity.z); } } private void OnCollisionStay(Collision collision) { if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent())) { ((Component)collision.transform.root).GetComponent().slip2 = 5f; } } private void Update() { } private void FixedUpdate() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_075a: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_0acf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae0: Unknown result type (might be due to invalid IL or missing references) //IL_0ae5: Unknown result type (might be due to invalid IL or missing references) //IL_0fca: Unknown result type (might be due to invalid IL or missing references) //IL_0fd4: Unknown result type (might be due to invalid IL or missing references) //IL_0ee6: Unknown result type (might be due to invalid IL or missing references) //IL_0eed: Unknown result type (might be due to invalid IL or missing references) //IL_0ef2: Unknown result type (might be due to invalid IL or missing references) //IL_0f0c: Unknown result type (might be due to invalid IL or missing references) //IL_0f17: Unknown result type (might be due to invalid IL or missing references) //IL_0f1c: Unknown result type (might be due to invalid IL or missing references) //IL_0f25: Unknown result type (might be due to invalid IL or missing references) //IL_0fec: Unknown result type (might be due to invalid IL or missing references) //IL_0b3b: Unknown result type (might be due to invalid IL or missing references) //IL_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_0d23: Unknown result type (might be due to invalid IL or missing references) if (!isOn) { accel = 0f; } Vector3 velocity = myRigidbody.velocity; speed = ((Vector3)(ref velocity)).magnitude * 2.7f; if (speed < lastSpeed - 10f && slip < 10f) { slip = lastSpeed / 15f; } lastSpeed = speed; if (slip2 != 0f) { slip2 = Mathf.MoveTowards(slip2, 0f, 0.1f); } myRigidbody.centerOfMass = carSetting.shiftCentre; if (!carWheels.wheels.frontWheelDrive && !carWheels.wheels.backWheelDrive) { accel = 0f; } if (Object.op_Implicit((Object)(object)carSetting.carSteer)) { carSetting.carSteer.localEulerAngles = new Vector3(steerCurAngle.x, steerCurAngle.y, steerCurAngle.z + steer * -120f); } if (carSetting.automaticGear && currentGear == 1 && accel < 0f) { if (speed < 5f) { ShiftDown(ignoreDelay: false); } } else if (carSetting.automaticGear && currentGear == 0 && accel > 0f) { if (speed < 5f) { ShiftUp(ignoreDelay: false); } } else if (carSetting.automaticGear && motorRPM > carSetting.shiftUpRPM && accel > 0f && speed > 10f && !brake) { ShiftUp(ignoreDelay: false); } else if (carSetting.automaticGear && motorRPM < carSetting.shiftDownRPM && currentGear > 1) { ShiftDown(ignoreDelay: false); } if (speed < 1f) { Backward = true; } if (currentGear != 0 || !Backward) { Backward = false; } Light[] brakeLights = carLights.brakeLights; foreach (Light val in brakeLights) { if (brake || accel < 0f || speed < 1f) { val.intensity = Mathf.MoveTowards(val.intensity, 8f, 0.5f); } else { val.intensity = Mathf.MoveTowards(val.intensity, 0f, 0.5f); } ((Behaviour)val).enabled = val.intensity != 0f; } Light[] reverseLights = carLights.reverseLights; foreach (Light val2 in reverseLights) { if (speed > 2f && currentGear == 0) { val2.intensity = Mathf.MoveTowards(val2.intensity, 8f, 0.5f); } else { val2.intensity = Mathf.MoveTowards(val2.intensity, 0f, 0.5f); } ((Behaviour)val2).enabled = val2.intensity != 0f; } wantedRPM = 5500f * accel * 0.1f + wantedRPM * 0.9f; float num = 0f; int num2 = 0; bool flag = false; int num3 = 0; WheelComponent[] array = wheels; WheelHit val4 = default(WheelHit); foreach (WheelComponent wheelComponent in array) { WheelCollider collider = wheelComponent.collider; if (wheelComponent.drive) { num = ((!NeutralGear && brake && currentGear < 2) ? (num + accel * carSetting.idleRPM) : (NeutralGear ? (num + carSetting.idleRPM * accel) : (num + collider.rpm))); num2++; } if (brake || accel < 0f) { if (accel < 0f || (brake && (wheelComponent == wheels[2] || wheelComponent == wheels[3]))) { if (brake && accel > 0f) { slip = Mathf.Lerp(slip, 5f, accel * 0.01f); } else if (speed > 1f) { slip = Mathf.Lerp(slip, 1f, 0.002f); } else { slip = Mathf.Lerp(slip, 1f, 0.02f); } wantedRPM = 0f; collider.brakeTorque = carSetting.brakePower; wheelComponent.rotation = w_rotate; } } else { float brakeTorque; if (accel == 0f || NeutralGear) { float num5 = (collider.brakeTorque = 1000f); brakeTorque = num5; } else { float num5 = (collider.brakeTorque = 0f); brakeTorque = num5; } collider.brakeTorque = brakeTorque; slip = ((!(speed > 0f)) ? (slip = Mathf.Lerp(slip, 0.01f, 0.02f)) : ((!(speed > 100f)) ? (slip = Mathf.Lerp(slip, 1.5f, 0.02f)) : (slip = Mathf.Lerp(slip, 1f + Mathf.Abs(steer), 0.02f)))); w_rotate = wheelComponent.rotation; } WheelFrictionCurve val3 = collider.forwardFriction; ((WheelFrictionCurve)(ref val3)).asymptoteValue = 5000f; ((WheelFrictionCurve)(ref val3)).extremumSlip = 2f; ((WheelFrictionCurve)(ref val3)).asymptoteSlip = 20f; ((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2); collider.forwardFriction = val3; val3 = collider.sidewaysFriction; ((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2); ((WheelFrictionCurve)(ref val3)).extremumSlip = 0.2f + Mathf.Abs(steer); collider.sidewaysFriction = val3; if (shift && currentGear > 1 && speed > 50f && shifmotor && Mathf.Abs(steer) < 0.2f) { if (powerShift == 0f) { shifmotor = false; } powerShift = Mathf.MoveTowards(powerShift, 0f, Time.deltaTime * 10f); carSounds.nitro.volume = Mathf.Lerp(carSounds.nitro.volume, 1f, Time.deltaTime * 10f); if (!carSounds.nitro.isPlaying) { ((Component)carSounds.nitro).GetComponent().Play(); } curTorque = ((!(powerShift > 0f)) ? carSetting.carPower : carSetting.shiftPower); carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f); carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f); } else { if (powerShift > 20f) { shifmotor = true; } carSounds.nitro.volume = Mathf.MoveTowards(carSounds.nitro.volume, 0f, Time.deltaTime * 2f); if (carSounds.nitro.volume == 0f) { carSounds.nitro.Stop(); } powerShift = Mathf.MoveTowards(powerShift, 100f, Time.deltaTime * 5f); curTorque = carSetting.carPower; carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, 0f, Time.deltaTime * 10f); carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, 0f, Time.deltaTime * 10f); } wheelComponent.rotation = Mathf.Repeat(wheelComponent.rotation + Time.deltaTime * collider.rpm * 360f / 60f, 360f); wheelComponent.rotation2 = Mathf.Lerp(wheelComponent.rotation2, collider.steerAngle, 0.1f); wheelComponent.wheel.localRotation = Quaternion.Euler(wheelComponent.rotation, wheelComponent.rotation2, 0f); Vector3 localPosition = wheelComponent.wheel.localPosition; if (collider.GetGroundHit(ref val4)) { if (Object.op_Implicit((Object)(object)carParticles.brakeParticlePerfab)) { if ((Object)(object)Particle[num3] == (Object)null) { Particle[num3] = Object.Instantiate(carParticles.brakeParticlePerfab, wheelComponent.wheel.position, Quaternion.identity); ((Object)Particle[num3]).name = "WheelParticle"; Particle[num3].transform.parent = ((Component)this).transform; Particle[num3].AddComponent(); Particle[num3].GetComponent().maxDistance = 50f; Particle[num3].GetComponent().spatialBlend = 1f; Particle[num3].GetComponent().dopplerLevel = 5f; Particle[num3].GetComponent().rolloffMode = (AudioRolloffMode)2; } ParticleSystem component = Particle[num3].GetComponent(); bool flag2 = false; for (int l = 0; l < carSetting.hitGround.Length; l++) { if (((Component)((WheelHit)(ref val4)).collider).CompareTag(carSetting.hitGround[l].tag)) { flag2 = carSetting.hitGround[l].grounded; if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.5f) && speed > 1f) { Particle[num3].GetComponent().clip = carSetting.hitGround[l].brakeSound; } else if ((Object)(object)Particle[num3].GetComponent().clip != (Object)(object)carSetting.hitGround[l].groundSound && !Particle[num3].GetComponent().isPlaying) { Particle[num3].GetComponent().clip = carSetting.hitGround[l].groundSound; } Particle[num3].GetComponent().startColor = carSetting.hitGround[l].brakeColor; } } if (flag2 && speed > 5f && !brake) { component.enableEmission = true; Particle[num3].GetComponent().volume = 0.5f; if (!Particle[num3].GetComponent().isPlaying) { Particle[num3].GetComponent().Play(); } } else if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && speed > 1f) { if (accel < 0f || ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && (wheelComponent == wheels[2] || wheelComponent == wheels[3]))) { if (!Particle[num3].GetComponent().isPlaying) { Particle[num3].GetComponent().Play(); } component.enableEmission = true; Particle[num3].GetComponent().volume = 10f; } } else { component.enableEmission = false; Particle[num3].GetComponent().volume = Mathf.Lerp(Particle[num3].GetComponent().volume, 0f, Time.deltaTime * 10f); } } localPosition.y -= Vector3.Dot(wheelComponent.wheel.position - ((WheelHit)(ref val4)).point, ((Component)this).transform.TransformDirection(0f, 1f, 0f) / ((Component)this).transform.lossyScale.x) - collider.radius; localPosition.y = Mathf.Clamp(localPosition.y, -10f, wheelComponent.pos_y); flag = flag || wheelComponent.drive; } else { if ((Object)(object)Particle[num3] != (Object)null) { ParticleSystem component2 = Particle[num3].GetComponent(); component2.enableEmission = false; } localPosition.y = wheelComponent.startPos.y - wheelComponent.settings.Distance; myRigidbody.AddForce(Vector3.down * 5000f); } num3++; wheelComponent.wheel.localPosition = localPosition; } if (num2 > 1) { num /= (float)num2; } motorRPM = 0.95f * motorRPM + 0.05f * Mathf.Abs(num * carSetting.gears[currentGear]); if (motorRPM > 5500f) { motorRPM = 5200f; } int num7 = (int)(motorRPM / efficiencyTableStep); if (num7 >= efficiencyTable.Length) { num7 = efficiencyTable.Length - 1; } if (num7 < 0) { num7 = 0; } float num8 = curTorque * carSetting.gears[currentGear] * efficiencyTable[num7]; WheelComponent[] array2 = wheels; foreach (WheelComponent wheelComponent2 in array2) { WheelCollider collider2 = wheelComponent2.collider; if (wheelComponent2.drive) { if (Mathf.Abs(collider2.rpm) > Mathf.Abs(wantedRPM)) { collider2.motorTorque = 0f; } else { float motorTorque = collider2.motorTorque; if (!brake && accel != 0f && !NeutralGear) { if ((speed < carSetting.LimitForwardSpeed && currentGear > 0) || (speed < carSetting.LimitBackwardSpeed && currentGear == 0)) { collider2.motorTorque = motorTorque * 0.9f + num8 * 1f; } else { collider2.motorTorque = 0f; collider2.brakeTorque = 2000f; } } else { collider2.motorTorque = 0f; } } } if (brake || slip2 > 2f) { collider2.steerAngle = Mathf.Lerp(collider2.steerAngle, steer * wheelComponent2.maxSteer, 0.02f); continue; } float num9 = Mathf.Clamp(speed / carSetting.maxSteerAngle, 1f, carSetting.maxSteerAngle); collider2.steerAngle = steer * (wheelComponent2.maxSteer / num9); } Pitch = Mathf.Clamp(1.2f + (motorRPM - carSetting.idleRPM) / (carSetting.shiftUpRPM - carSetting.idleRPM), 1f, 10f); shiftTime = Mathf.MoveTowards(shiftTime, 0f, 0.1f); if (Pitch == 1f) { carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1f, 0.1f); carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.1f); } else { carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1.8f - Pitch, 0.1f); if ((Pitch > PitchDelay || accel > 0f) && shiftTime == 0f) { carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0f, 0.2f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 1f, 0.1f); } else { carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.2f); } carSounds.HighEngine.pitch = Pitch; carSounds.LowEngine.pitch = Pitch; PitchDelay = Pitch; } if (!isOn) { carSounds.IdleEngine.volume = 0f; carSounds.LowEngine.volume = 0f; carSounds.HighEngine.volume = 0f; } } private void OnDrawGizmos() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (carSetting.showNormalGizmos && !Application.isPlaying) { Matrix4x4 matrix = Matrix4x4.TRS(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.lossyScale); Gizmos.matrix = matrix; Gizmos.color = new Color(1f, 0f, 0f, 0.5f); Gizmos.DrawCube(Vector3.up / 1.5f, new Vector3(2.5f, 2f, 6f)); Gizmos.DrawSphere(carSetting.shiftCentre / ((Component)this).transform.lossyScale.x, 0.2f); } } }