

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using H3VRUtils;
using HarmonyLib;
using ModularWorkshop;
using OpenScripts2;
using OtherLoader;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Rendering;
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]
namespace ShermanJumbo
{
public class AnimationPlayOnFire : MonoBehaviour
{
public FVRFireArm FireArm;
public Animator Animator;
public string FiringAnimationNode = "GunFire";
public void Awake()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(ShotFired);
}
public void OnDestroy()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(ShotFired);
}
private void ShotFired(FVRFireArm firearm)
{
if ((Object)(object)firearm == (Object)(object)FireArm)
{
Animator.Play(FiringAnimationNode);
}
}
}
public class BallisticProjLightningBolt : MonoBehaviour
{
public GameObject TransformToMove;
private Vector3 SpawnLocation;
private void Start()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
SpawnLocation = ((Component)this).gameObject.transform.position;
}
private void Update()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
TransformToMove.transform.position = SpawnLocation;
}
}
public class BallisticProjectileKillIfBelowSpeed : MonoBehaviour
{
public BallisticProjectile Projectile;
public float KillIfVelBelowThisMagnitude = 20f;
private void Update()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (((Vector3)(ref Projectile.m_velocity)).magnitude <= KillIfVelBelowThisMagnitude)
{
Projectile.m_velocity = Vector3.zero;
}
}
}
}
public class BreakActionMainHandFireSelector : MonoBehaviour
{
public BreakActionWeapon Weapon;
public Transform SelectorSwitch;
public Vector3 PosSingleFire;
public Vector3 PosMultiFire;
public bool SwapsTrigger = false;
public Transform SecondTrigger;
public float SecondTriggerPulledAngle = 20f;
private Transform OriginalTrigger;
private float OriginalTriggerPulled;
private void Awake()
{
OriginalTrigger = Weapon.Triggers[0];
OriginalTriggerPulled = Weapon.TriggerPulled;
}
private void Update()
{
//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)
FVRViveHand hand = ((FVRInteractiveObject)Weapon).m_hand;
if (!((Object)(object)hand == (Object)null) && ((hand.IsInStreamlinedMode && hand.Input.AXButtonDown) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f)))
{
SwapFiremodes();
}
}
public void SwapFiremodes()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)15, 1f);
if (Weapon.FireAllBarrels)
{
Weapon.FireAllBarrels = false;
SelectorSwitch.localPosition = PosSingleFire;
if (SwapsTrigger)
{
Weapon.Triggers[0] = OriginalTrigger;
Weapon.TriggerPulled = OriginalTriggerPulled;
}
}
else if (!Weapon.FireAllBarrels)
{
Weapon.FireAllBarrels = true;
SelectorSwitch.localPosition = PosMultiFire;
if (SwapsTrigger)
{
Weapon.Triggers[0] = SecondTrigger;
Weapon.TriggerPulled = SecondTriggerPulledAngle;
}
}
}
}
namespace ShermanJumbo
{
public class BreakActionSpeedloaderInsertTrigger : MonoBehaviour
{
public BreakActionWeapon Weapon;
}
public class BreakActionSpeedloaderTrigger : MonoBehaviour
{
public FVRFireArmMagazine Loader;
private void OnTriggerEnter(Collider collider)
{
//IL_006a: 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_00ff: 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_010d: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Loader != (Object)null) || !((Object)(object)Loader.FireArm == (Object)null) || !((Object)(object)((FVRPhysicalObject)Loader).QuickbeltSlot == (Object)null) || !((Object)(object)((Component)collider).gameObject.GetComponent<BreakActionSpeedloaderInsertTrigger>() != (Object)null))
{
return;
}
BreakActionSpeedloaderInsertTrigger component = ((Component)collider).gameObject.GetComponent<BreakActionSpeedloaderInsertTrigger>();
BreakActionWeapon weapon = component.Weapon;
if (((FVRFireArm)weapon).RoundType != Loader.RoundType || weapon.m_isLatched)
{
return;
}
for (int i = 0; i < weapon.Barrels.Length; i++)
{
if (Loader.HasARound() && !weapon.Barrels[i].Chamber.IsFull)
{
FVRLoadedRound val = Loader.RemoveRound(0);
Transform transform = Loader.DisplayBullets[Mathf.Clamp(0, Loader.DisplayBullets.Length - 1, i)].transform;
weapon.Barrels[i].Chamber.Autochamber(val.LR_Class, transform.position, transform.rotation);
((FVRFireArm)weapon).PlayAudioEvent((FirearmAudioEventType)20, 1f);
}
}
}
}
public class CSGCapTrigger : FVRInteractiveObject
{
public CappedStickyGrenade Grenade;
public override void SimpleInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).SimpleInteraction(hand);
if (!Grenade.m_isArmed)
{
Grenade.Arm();
}
}
}
public class CSGDestroyNotifier : MonoBehaviour
{
public delegate void DestroyedAction();
public event DestroyedAction OnDestroyed;
private void OnDestroy()
{
if (this.OnDestroyed != null)
{
this.OnDestroyed();
}
}
}
public class CannonballSecondaryRenderer : MonoBehaviour
{
public Renderer Rend;
public CannonBall Cannonball;
private void Update()
{
if (Cannonball.TurnsOffRends && !Cannonball.hasTurnedOffRends)
{
Rend.enabled = false;
}
}
}
public class CappedStickyGrenade : FVRPhysicalObject
{
[Serializable]
public class CSGDetonationStage
{
public bool HasFired = false;
public float FireWhenFuseHits = 0f;
public GameObject[] PrefabToSpawn;
}
[Header("Grenade Settings")]
public Rigidbody grenadeRigidbody;
public bool m_isArmed = false;
public float FuseTime = 0f;
public List<GameObject> SpawnOnSplode;
public AudioEvent ArmedSound;
public int IFF;
private float m_fuseTime = 0f;
private bool m_hasSploded = false;
public bool UsesStagedDetonation = false;
public CSGDetonationStage[] DetonationStages;
[Header("Cap Settings")]
public bool UsesCapSystem = false;
public GameObject DummyCap;
public GameObject CapPrefab;
public Transform CapPrefabSpawnPos;
[Header("Sticky Grenade Settings")]
public bool isStickyGrenade = true;
public Collider stickyCollider;
public float stickingDistance = 0.1f;
public LayerMask stickyLayers;
public float embeddingDistance = 0.02f;
public bool playStickSoundForRigidbodiesOnly = true;
public AudioEvent stickSounds;
public float minimumStickVelocity = 2f;
public float regrabActivationDelay = 0.5f;
public float massWhileStuck = 10f;
private bool wasHeld = false;
private bool armChecked = false;
private bool shouldCheckVelocity = false;
private bool hasReleasedLever = false;
private bool isSticking = false;
private bool canStick = false;
private float timeSinceRelease = 0f;
private GameObject parentObject;
private Vector3 savedPosition;
private Quaternion savedRotation;
private Vector3 savedScale;
private FVRInteractiveObject interactiveObject;
private bool isCookingCoroutineRunning = false;
[Header("Extra Settings")]
public bool UsesArmedPfx = false;
public ParticleSystem[] Pfx;
public float ActivateParticlesWhenFuseHits = 3f;
private bool HasActivatedParticles = false;
public bool PlaysAnimationOnArm = false;
public Animator Animator;
public string ArmingAnimationNode = "animation";
public bool PlaysSoundWhileArmed = false;
public AudioSource ArmedSounds;
public float ActivateSoundsWhenFuseHits = 0f;
private bool HasPlayedArmedSounds = false;
private void Start()
{
interactiveObject = ((Component)this).GetComponent<FVRInteractiveObject>();
if (UsesArmedPfx)
{
ParticleSystem[] pfx = Pfx;
foreach (ParticleSystem val in pfx)
{
if (val.isPlaying)
{
val.Stop();
}
}
}
if (PlaysSoundWhileArmed && ArmedSounds.isPlaying)
{
ArmedSounds.Stop();
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
((FVRPhysicalObject)this).UpdateInteraction(hand);
IFF = GM.CurrentPlayerBody.GetPlayerIFF();
}
public override void FVRUpdate()
{
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_0453: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).FVRUpdate();
if (!armChecked && m_isArmed)
{
armChecked = true;
shouldCheckVelocity = true;
if (isStickyGrenade)
{
EnableStickyCollider();
}
}
if (!wasHeld && ((FVRInteractiveObject)this).IsHeld)
{
timeSinceRelease = 0f;
if (m_isArmed)
{
EnableStickyCollider();
}
shouldCheckVelocity = m_isArmed;
wasHeld = true;
canStick = true;
isSticking = false;
FixedJoint component = ((Component)this).GetComponent<FixedJoint>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.detectCollisions = true;
grenadeRigidbody.useGravity = true;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
Debug.Log((object)"FixedJoint grenade unstuck upon being picked up.");
}
else if ((Object)(object)((Component)this).transform.parent != (Object)null && ((Object)((Component)((Component)this).transform.parent).gameObject).name == "DummyParent")
{
GameObject gameObject = ((Component)((Component)this).transform.parent).gameObject;
((Component)this).transform.SetParent((Transform)null, true);
Object.Destroy((Object)(object)gameObject);
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.detectCollisions = true;
grenadeRigidbody.useGravity = true;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
Debug.Log((object)"Static-stuck grenade unstuck upon being picked up.");
}
if (isStickyGrenade)
{
DisableStickyColliderTemporarily();
}
}
if (wasHeld && !((FVRInteractiveObject)this).IsHeld)
{
isSticking = false;
wasHeld = false;
}
if (m_isArmed || !((FVRInteractiveObject)this).IsHeld)
{
DisableMeleeDamage((FVRPhysicalObject)(object)this);
}
else
{
EnableMeleeDamage((FVRPhysicalObject)(object)this);
}
if (!m_isArmed)
{
return;
}
m_fuseTime -= Time.deltaTime;
if (m_fuseTime < ActivateParticlesWhenFuseHits && !HasActivatedParticles)
{
HasActivatedParticles = true;
ParticleSystem[] pfx = Pfx;
foreach (ParticleSystem val in pfx)
{
val.Play();
}
}
if (m_fuseTime < ActivateSoundsWhenFuseHits && !HasPlayedArmedSounds)
{
HasPlayedArmedSounds = true;
ArmedSounds.Play();
}
if (m_fuseTime <= 0.05f)
{
if (!m_hasSploded)
{
m_hasSploded = true;
ParticleSystem[] pfx2 = Pfx;
foreach (ParticleSystem val2 in pfx2)
{
if (val2.isPlaying)
{
val2.Stop();
}
}
for (int k = 0; k < SpawnOnSplode.Count; k++)
{
GameObject val3 = Object.Instantiate<GameObject>(SpawnOnSplode[k], ((Component)this).transform.position, Quaternion.identity);
Explosion component2 = val3.GetComponent<Explosion>();
if ((Object)(object)component2 != (Object)null)
{
component2.IFF = IFF;
}
ExplosionSound component3 = val3.GetComponent<ExplosionSound>();
if ((Object)(object)component3 != (Object)null)
{
component3.IFF = IFF;
}
GrenadeExplosion component4 = val3.GetComponent<GrenadeExplosion>();
if ((Object)(object)component4 != (Object)null)
{
component4.IFF = IFF;
}
}
}
else
{
if (((FVRInteractiveObject)this).IsHeld)
{
FVRViveHand hand = ((FVRInteractiveObject)this).m_hand;
((FVRInteractiveObject)this).m_hand.ForceSetInteractable((FVRInteractiveObject)null);
((FVRInteractiveObject)this).EndInteraction(hand);
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
if (!UsesStagedDetonation)
{
return;
}
CSGDetonationStage[] detonationStages = DetonationStages;
foreach (CSGDetonationStage cSGDetonationStage in detonationStages)
{
if (!cSGDetonationStage.HasFired && m_fuseTime <= cSGDetonationStage.FireWhenFuseHits)
{
cSGDetonationStage.HasFired = true;
GameObject[] prefabToSpawn = cSGDetonationStage.PrefabToSpawn;
foreach (GameObject val4 in prefabToSpawn)
{
Object.Instantiate<GameObject>(val4, ((Component)this).transform.position, ((Component)this).transform.rotation);
}
}
}
}
public override void FVRFixedUpdate()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).FVRFixedUpdate();
if (shouldCheckVelocity && ((FVRInteractiveObject)this).IsHeld)
{
Vector3 velocity = grenadeRigidbody.velocity;
if (((Vector3)(ref velocity)).magnitude >= minimumStickVelocity)
{
canStick = true;
}
else
{
canStick = false;
}
}
}
private void DisableMeleeDamage(FVRPhysicalObject physicalObject)
{
if (physicalObject.MP != null && physicalObject.MP.IsMeleeWeapon)
{
physicalObject.MP.IsMeleeWeapon = false;
}
}
private void EnableMeleeDamage(FVRPhysicalObject physicalObject)
{
if (physicalObject.MP != null && !physicalObject.MP.IsMeleeWeapon)
{
physicalObject.MP.IsMeleeWeapon = true;
}
}
private void OnCollisionEnter(Collision collision)
{
//IL_00a6: 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_00c6: 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_0103: Unknown result type (might be due to invalid IL or missing references)
if (!m_isArmed || isSticking || !isStickyGrenade || !((Object)(object)stickyCollider != (Object)null) || (Object)(object)collision.gameObject.GetComponent<BreakableGlass>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenade>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenadePin>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<SosigWeapon>() != (Object)null)
{
return;
}
ContactPoint[] contacts = collision.contacts;
for (int i = 0; i < contacts.Length; i++)
{
ContactPoint contact = contacts[i];
if (!((Object)(object)((ContactPoint)(ref contact)).thisCollider == (Object)(object)stickyCollider))
{
continue;
}
if ((LayerMask.op_Implicit(stickyLayers) & (1 << collision.gameObject.layer)) == 0 || !IsContactPointWithinStickingDistance(((ContactPoint)(ref contact)).point))
{
break;
}
isSticking = true;
StickToSurface(collision, contact);
PlayStickingSound(collision);
parentObject = collision.gameObject;
if ((Object)(object)parentObject != (Object)null)
{
CSGDestroyNotifier cSGDestroyNotifier = parentObject.GetComponent<CSGDestroyNotifier>();
if ((Object)(object)cSGDestroyNotifier == (Object)null)
{
cSGDestroyNotifier = parentObject.AddComponent<CSGDestroyNotifier>();
}
cSGDestroyNotifier.OnDestroyed += OnDestroyUnstickGrenade;
}
break;
}
}
private bool IsContactPointWithinStickingDistance(Vector3 contactPoint)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = stickyCollider.ClosestPoint(contactPoint);
float num = Vector3.Distance(contactPoint, val);
return num < stickingDistance;
}
private void StickToSurface(Collision collision, ContactPoint contact)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Expected O, but got Unknown
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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)
if ((Object)(object)stickyCollider == (Object)null)
{
return;
}
if ((Object)(object)interactiveObject != (Object)null && interactiveObject.IsHeld)
{
interactiveObject.ForceBreakInteraction();
}
savedPosition = ((Component)this).transform.position;
savedRotation = ((Component)this).transform.rotation;
Vector3 lossyScale = ((Component)this).transform.lossyScale;
Rigidbody rigidbody = collision.rigidbody;
Vector3 val = ((ContactPoint)(ref contact)).normal * embeddingDistance;
if ((Object)(object)rigidbody != (Object)null)
{
((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val;
FixedJoint component = ((Component)this).GetComponent<FixedJoint>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
FixedJoint val2 = ((Component)this).gameObject.AddComponent<FixedJoint>();
((Joint)val2).connectedBody = rigidbody;
((Joint)val2).breakForce = float.MaxValue;
((Joint)val2).breakTorque = float.MaxValue;
grenadeRigidbody.useGravity = false;
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
grenadeRigidbody.mass = massWhileStuck;
SetCollidersToLayer(stickyCollider, "NoCol");
}
else
{
GameObject val3 = new GameObject("DummyParent");
val3.transform.position = ((ContactPoint)(ref contact)).point;
val3.transform.rotation = collision.transform.rotation;
grenadeRigidbody.isKinematic = true;
val3.transform.SetParent(collision.transform, true);
((Component)this).transform.SetParent(val3.transform, false);
((Component)this).transform.localScale = new Vector3(lossyScale.x / ((Component)this).transform.lossyScale.x, lossyScale.y / ((Component)this).transform.lossyScale.y, lossyScale.z / ((Component)this).transform.lossyScale.z);
((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val;
((Component)this).transform.rotation = savedRotation;
}
}
private void EnableStickyCollider()
{
if ((Object)(object)stickyCollider != (Object)null)
{
stickyCollider.enabled = true;
}
}
private void DisableStickyColliderTemporarily()
{
if ((Object)(object)stickyCollider != (Object)null)
{
stickyCollider.enabled = false;
}
((MonoBehaviour)this).StartCoroutine(ReenableStickyColliderAfterDelay());
}
private IEnumerator ReenableStickyColliderAfterDelay()
{
yield return (object)new WaitForSeconds(regrabActivationDelay);
EnableStickyCollider();
}
private void PlayStickingSound(Collision collision)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if ((playStickSoundForRigidbodiesOnly && (Object)(object)collision.rigidbody != (Object)null) || !playStickSoundForRigidbodiesOnly)
{
SM.PlayCoreSound((FVRPooledAudioType)10, stickSounds, ((Component)this).transform.position);
}
}
private void OnDestroyUnstickGrenade()
{
if ((Object)(object)this == (Object)null)
{
return;
}
if ((Object)(object)parentObject != (Object)null)
{
CSGDestroyNotifier component = parentObject.GetComponent<CSGDestroyNotifier>();
if ((Object)(object)component != (Object)null)
{
component.OnDestroyed -= OnDestroyUnstickGrenade;
}
parentObject = null;
}
FixedJoint component2 = ((Component)this).GetComponent<FixedJoint>();
if ((Object)(object)component2 != (Object)null)
{
Object.Destroy((Object)(object)component2);
}
else if ((Object)(object)((Component)this).transform.parent != (Object)null)
{
((Component)this).transform.SetParent((Transform)null);
}
if ((Object)(object)grenadeRigidbody != (Object)null)
{
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.detectCollisions = true;
grenadeRigidbody.useGravity = true;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
}
isSticking = false;
if ((Object)(object)stickyCollider != (Object)null)
{
stickyCollider.enabled = false;
}
canStick = false;
}
private void SetCollidersToLayer(Collider collider, string layer)
{
((Component)collider).gameObject.layer = LayerMask.NameToLayer(layer);
}
private void OnDestroy()
{
if ((Object)(object)parentObject != (Object)null)
{
CSGDestroyNotifier component = parentObject.GetComponent<CSGDestroyNotifier>();
if ((Object)(object)component != (Object)null)
{
component.OnDestroyed -= OnDestroyUnstickGrenade;
}
}
}
public void Arm()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: 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)
if (!m_isArmed)
{
m_isArmed = true;
m_fuseTime = FuseTime;
SM.PlayCoreSound((FVRPooledAudioType)10, ArmedSound, ((Component)this).transform.position);
if (PlaysAnimationOnArm)
{
Animator.Play(ArmingAnimationNode);
}
if (UsesCapSystem)
{
DummyCap.SetActive(false);
Object.Instantiate<GameObject>(CapPrefab, CapPrefabSpawnPos.position, CapPrefabSpawnPos.rotation);
}
}
}
}
public class ChamberDependentParticlesAndSounds : MonoBehaviour
{
public FVRFireArmChamber ChamberToRead;
public ParticleSystem ParticlesToEnable;
public AudioSource SoundsToEnable;
private void Update()
{
if (ChamberToRead.IsFull)
{
if (!ParticlesToEnable.isPlaying)
{
ParticlesToEnable.Play();
}
if (!SoundsToEnable.isPlaying)
{
SoundsToEnable.Play();
}
}
else
{
ParticlesToEnable.Stop();
SoundsToEnable.Stop();
}
}
}
public class ClosedBoltBeltFedDualFeedFix : MonoBehaviour
{
public ClosedBoltWeapon Weapon;
public ClosedBoltMagEjectionTrigger MagGrabTrigger;
public Vector3 TriggerPosForBeltBox;
public Vector3 ScaleForBeltBoxTrigger;
private Vector3 TriggerPosForMag;
private Vector3 ScaleForMagTrigger;
private void Start()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
TriggerPosForMag = ((FVRInteractiveObject)MagGrabTrigger).Transform.localPosition;
ScaleForMagTrigger = ((FVRInteractiveObject)MagGrabTrigger).Transform.localScale;
}
private void Update()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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)
FVRFireArmMagazine magazine = ((FVRFireArm)Weapon).Magazine;
ClosedBoltMagEjectionTrigger magGrabTrigger = MagGrabTrigger;
if ((Object)(object)magazine == (Object)null)
{
return;
}
if (!magazine.IsBeltBox)
{
((Component)magGrabTrigger).gameObject.SetActive(true);
((FVRInteractiveObject)magGrabTrigger).Transform.localPosition = TriggerPosForMag;
((FVRInteractiveObject)magGrabTrigger).Transform.localScale = ScaleForMagTrigger;
}
if (magazine.IsBeltBox)
{
if (!((FVRFireArm)Weapon).ConnectedToBox)
{
((Component)magGrabTrigger).gameObject.SetActive(true);
((FVRInteractiveObject)magGrabTrigger).Transform.localPosition = TriggerPosForBeltBox;
((FVRInteractiveObject)magGrabTrigger).Transform.localScale = ScaleForBeltBoxTrigger;
}
else
{
((Component)MagGrabTrigger).gameObject.SetActive(false);
}
}
}
}
public class ClosedBoltMagReleaseSelector : MonoBehaviour
{
public ClosedBoltWeapon Gun;
public Vector3 MagReleaseUnpress_Safe;
public Vector3 MagReleaseUnpress_NotSafe;
private void Update()
{
//IL_0018: 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if ((int)Gun.FireSelector_Modes[Gun.m_fireSelectorMode].ModeType == 0)
{
Gun.MagReleaseUnpressed = MagReleaseUnpress_Safe;
}
else
{
Gun.MagReleaseUnpressed = MagReleaseUnpress_NotSafe;
}
}
}
public class ClosedBoltPokeToChamberRound : FVRInteractiveObject
{
public ClosedBoltWeapon Weapon;
public FVRFireArmChamber Chamber;
public override void Poke(FVRViveHand hand)
{
if (((Object)(object)((FVRInteractiveObject)Weapon).m_hand == (Object)null || (Object)(object)hand != (Object)(object)((FVRInteractiveObject)Weapon).m_hand) && !Chamber.IsFull)
{
Weapon.Bolt.ImpartFiringImpulse();
}
}
}
public class Commando : FVRFireArm
{
[Serializable]
public class CommandoMovingPart
{
public MovableObjectPart ObjectPart;
public E_State DesiredState;
}
[Header("Commando")]
public FVRFireArmChamber[] CommandoChambers;
public Transform[] CommandoMuzzles;
public int CurrentChamber = 0;
public bool AlsoPlaysSecondFireSound = true;
public AudioEvent SecondFireSound;
public Transform SecondFireSoundPosition;
public bool DeletesCartridgeOnFire = true;
public bool DestroyWhenEmpty = false;
public float KillDelay = 30f;
public bool IsEmpty = false;
public bool UseEnableDisablePerChamberSystem = true;
public GameObject[] EnableIfCorrespondingChamberIsSpent;
public GameObject[] DisableIfCorrespondingChamberIsSpent;
public Transform Trigger;
public float Trigger_ForwardValue;
public float Trigger_RearwardValue;
public Axis TriggerAxis;
public InterpStyle TriggerInterpStyle = (InterpStyle)1;
private float m_triggerFloat;
[Header("Moving Parts Stuff")]
public bool UsesMovingPartSystem = false;
public bool AllMovingPartsReady = false;
public CommandoMovingPart[] MovingParts;
public override void Awake()
{
((FVRFireArm)this).Awake();
FVRFireArmChamber[] commandoChambers = CommandoChambers;
foreach (FVRFireArmChamber item in commandoChambers)
{
base.FChambers.Add(item);
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).UpdateInteraction(hand);
m_triggerFloat = hand.Input.TriggerFloat;
if ((Object)(object)Trigger != (Object)null)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), TriggerInterpStyle, TriggerAxis);
}
if (!((FVRPhysicalObject)this).IsAltHeld && hand.Input.TriggerDown && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && CurrentChamber <= CommandoChambers.Length - 1)
{
Fire();
}
IsEmpty = true;
FVRFireArmChamber[] commandoChambers = CommandoChambers;
foreach (FVRFireArmChamber val in commandoChambers)
{
if (val.IsFull && !val.IsSpent)
{
IsEmpty = false;
break;
}
}
if (IsEmpty && DestroyWhenEmpty)
{
Object.Destroy((Object)(object)((Component)this).gameObject, KillDelay);
}
}
public override Transform GetMuzzle()
{
return CommandoMuzzles[CurrentChamber];
}
public void Fire()
{
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: 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_0063: Unknown result type (might be due to invalid IL or missing references)
if (!CommandoChambers[CurrentChamber].IsFull || CommandoChambers[CurrentChamber].IsSpent)
{
return;
}
if (UsesMovingPartSystem)
{
AllMovingPartsReady = true;
CommandoMovingPart[] movingParts = MovingParts;
foreach (CommandoMovingPart commandoMovingPart in movingParts)
{
if (commandoMovingPart.ObjectPart.State != commandoMovingPart.DesiredState)
{
AllMovingPartsReady = false;
}
}
if (!AllMovingPartsReady)
{
return;
}
}
FVRFireArmChamber val = CommandoChambers[CurrentChamber];
val.Fire();
((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
((FVRFireArm)this).FireMuzzleSmoke();
bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null;
bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
((FVRFireArm)this).PlayAudioGunShot(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
if (AlsoPlaysSecondFireSound)
{
SM.PlayCoreSound((FVRPooledAudioType)0, SecondFireSound, ((Component)SecondFireSoundPosition).transform.position);
}
if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo)
{
val.IsSpent = false;
val.UpdateProxyDisplay();
}
else if (DeletesCartridgeOnFire)
{
val.SetRound((FVRFireArmRound)null, false);
}
if (UseEnableDisablePerChamberSystem)
{
EnableIfCorrespondingChamberIsSpent[CurrentChamber].SetActive(true);
DisableIfCorrespondingChamberIsSpent[CurrentChamber].SetActive(false);
}
CurrentChamber++;
if (CurrentChamber >= CommandoChambers.Length)
{
CurrentChamber = 0;
}
}
public override List<FireArmRoundClass> GetChamberRoundList()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
if (CommandoChambers[0].IsFull && !CommandoChambers[0].IsSpent)
{
List<FireArmRoundClass> list = new List<FireArmRoundClass>();
list.Add(CommandoChambers[0].GetRound().RoundClass);
return list;
}
return null;
}
public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
FVRFireArmChamber[] commandoChambers = CommandoChambers;
foreach (FVRFireArmChamber val in commandoChambers)
{
if (rounds.Count > 0)
{
val.Autochamber(rounds[0]);
}
}
}
}
public class DemonadeProximityDetonate : MonoBehaviour
{
public MF2_Demonade Demonade;
public float ActivationDelay = 1f;
private float m_timetoDelay = 0f;
private bool isArmed = false;
private void Update()
{
if (m_timetoDelay < ActivationDelay)
{
m_timetoDelay += Time.deltaTime;
}
if (m_timetoDelay >= ActivationDelay)
{
isArmed = true;
}
}
private void OnTriggerEnter(Collider other)
{
if (isArmed)
{
string text = LayerMask.LayerToName(((Component)other).gameObject.layer);
if (Demonade.ExplodeOnContactLayerName == text)
{
Demonade.Explode();
}
}
}
}
public class DisableIfCurrentMagIsBeltBox : MonoBehaviour
{
public FVRFireArm Firearm;
public GameObject GameObjectToDisable;
private void Update()
{
GameObjectToDisable.SetActive(true);
}
}
public class Epoch : FVRFireArm
{
[Header("Epoch Component Params")]
public GameObject UnchargedBolt;
public GameObject ChargedBolt;
private bool HasRound = false;
[Header("Epoch Trigger Params")]
public float TriggerBreakPoint;
public Transform Trigger;
public float Trigger_ForwardValue;
public float Trigger_RearwardValue;
public Axis TriggerAxis;
public InterpStyle TriggerInterpStyle = (InterpStyle)1;
private float TriggerHeldStartTime = 0f;
public float SafeHoldTime = 1f;
public float MaxUnsafeHoldTime = 3f;
public GameObject[] SelfDestructPrefabs;
private float m_triggerFloat;
private bool IsChargedToPowerful = false;
private float ManipulationFactor = 0f;
private float ManipulationFactor2 = 0f;
private bool HasStartedCharging = false;
[Header("Epoch Visual Params")]
public ParticleSystem ChargingParticles;
public ParticleSystem ChargedParticles;
public ParticleSystem FiringParticles;
public int NumberOfParticles;
public Transform MainChargeBars;
public Vector2 YScaleMainSafe;
public Vector2 YScaleMainUnsafe;
public Transform OpticChargeBar;
public Vector2 YScaleOptic;
public Vector2 YScaleOpticUnsafe;
[Header("Epoch Audio Params")]
public FVRTailSoundClass TailClass = (FVRTailSoundClass)8;
public AudioEvent ChargingClip;
public AudioEvent FullyChargedClip;
public AudioSource ChargeLoopAudio;
private bool HasPlayedFullyChargedSound = false;
public float MaxChargeLoopPitch = 1.5f;
private void Start()
{
ChargeLoopAudio.Stop();
ChargingParticles.Stop();
ChargedParticles.Stop();
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRFireArm)this).EndInteraction(hand);
ManipulationFactor = 0f;
ManipulationFactor2 = 0f;
if (ChargingParticles.isPlaying)
{
ChargingParticles.Stop();
}
if (ChargedParticles.isPlaying)
{
ChargedParticles.Stop();
}
if (ChargeLoopAudio.isPlaying)
{
ChargeLoopAudio.Stop();
}
HasPlayedFullyChargedSound = false;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_009e: 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_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).UpdateInteraction(hand);
m_triggerFloat = hand.Input.TriggerFloat;
if (IsChargedToPowerful && !ChargeLoopAudio.isPlaying)
{
ChargeLoopAudio.Play();
}
if (!IsChargedToPowerful && ChargeLoopAudio.isPlaying)
{
ChargeLoopAudio.Stop();
}
if ((Object)(object)Trigger != (Object)null)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), TriggerInterpStyle, TriggerAxis);
}
HasRound = true;
EpochMagazine epochMagazine = (EpochMagazine)(object)base.Magazine;
if ((Object)(object)epochMagazine == (Object)null || epochMagazine.NumOfRoundsRemaining == 0)
{
HasRound = false;
}
if (!((FVRPhysicalObject)this).IsAltHeld && m_triggerFloat >= TriggerBreakPoint && !HasStartedCharging && HasRound)
{
HasStartedCharging = true;
TriggerHeldStartTime = Time.time;
IsChargedToPowerful = false;
ManipulationFactor = 0f;
SM.PlayCoreSound((FVRPooledAudioType)0, ChargingClip, ((Component)this).transform.position);
}
if (!((FVRPhysicalObject)this).IsAltHeld && m_triggerFloat >= TriggerBreakPoint)
{
float num = Time.time - TriggerHeldStartTime;
if (num < SafeHoldTime)
{
ManipulationFactor = Mathf.Clamp01(num / SafeHoldTime);
}
if (num >= SafeHoldTime)
{
ManipulationFactor = 1f;
IsChargedToPowerful = true;
if (!HasPlayedFullyChargedSound)
{
SM.PlayCoreSound((FVRPooledAudioType)0, FullyChargedClip, ((Component)this).transform.position);
HasPlayedFullyChargedSound = true;
}
}
if (num >= SafeHoldTime && num < MaxUnsafeHoldTime)
{
if (!HasPlayedFullyChargedSound)
{
SM.PlayCoreSound((FVRPooledAudioType)0, FullyChargedClip, ((Component)this).transform.position);
HasPlayedFullyChargedSound = true;
}
ManipulationFactor = 1f;
IsChargedToPowerful = true;
ManipulationFactor2 = Mathf.Clamp01((num - SafeHoldTime) / (MaxUnsafeHoldTime - SafeHoldTime));
ChargeLoopAudio.pitch = 1f + ManipulationFactor2 * MaxChargeLoopPitch;
}
if (num >= MaxUnsafeHoldTime)
{
SelfDestruct(hand);
}
if (!ChargingParticles.isPlaying)
{
ChargingParticles.Play();
}
}
if (m_triggerFloat < TriggerBreakPoint && IsChargedToPowerful && !((FVRPhysicalObject)this).IsAltHeld)
{
Fire();
IsChargedToPowerful = false;
ManipulationFactor = 0f;
ManipulationFactor2 = 0f;
FiringParticles.Emit(NumberOfParticles);
ChargingParticles.Stop();
HasPlayedFullyChargedSound = false;
}
if (m_triggerFloat < TriggerBreakPoint && !IsChargedToPowerful)
{
ManipulationFactor = 0f;
if (ChargingParticles.isPlaying)
{
ChargingParticles.Stop();
}
HasPlayedFullyChargedSound = false;
HasStartedCharging = false;
TriggerHeldStartTime = Time.time;
}
UpdateAnimatedParts();
}
public void UpdateAnimatedParts()
{
//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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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)
float num = YScaleMainSafe.x - YScaleMainSafe.y;
float num2 = YScaleMainUnsafe.x - YScaleMainUnsafe.y;
Vector3 localScale = ((Component)MainChargeBars).transform.localScale;
localScale.y = 1f - (ManipulationFactor * num + ManipulationFactor2 * num2);
((Component)MainChargeBars).transform.localScale = localScale;
float num3 = YScaleOptic.x - YScaleOptic.y;
float num4 = YScaleOpticUnsafe.x - YScaleOpticUnsafe.y;
Vector3 localScale2 = ((Component)OpticChargeBar).transform.localScale;
localScale2.y = 1f - (num3 * ManipulationFactor + ManipulationFactor2 * num4);
((Component)OpticChargeBar).transform.localScale = localScale2;
if (IsChargedToPowerful && !ChargedParticles.isPlaying)
{
ChargedParticles.Play();
}
if (!IsChargedToPowerful && ChargedParticles.isPlaying)
{
ChargedParticles.Stop();
}
}
public void Fire()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: 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_0102: 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_0055: Unknown result type (might be due to invalid IL or missing references)
GameObject val = null;
if (IsChargedToPowerful)
{
val = Object.Instantiate<GameObject>(UnchargedBolt, ((FVRFireArm)this).GetMuzzle().position, ((FVRFireArm)this).GetMuzzle().rotation);
}
if (!IsChargedToPowerful)
{
val = Object.Instantiate<GameObject>(ChargedBolt, ((FVRFireArm)this).GetMuzzle().position, ((FVRFireArm)this).GetMuzzle().rotation);
}
BallisticProjectile component = val.GetComponent<BallisticProjectile>();
component.Fire(val.transform.forward, (FVRFireArm)(object)this);
HasPlayedFullyChargedSound = false;
((FVRFireArm)this).FireMuzzleSmoke();
bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null;
bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
base.m_pool_shot.PlayClip(base.AudioClipSet.Shots_Main, base.MuzzlePos.position, (AudioMixerGroup)null);
base.m_pool_tail.PlayClipPitchOverride(SM.GetTailSet(TailClass, GM.CurrentPlayerBody.GetCurrentSoundEnvironment()), ((FVRFireArm)this).GetMuzzle().position, base.AudioClipSet.TailPitchMod_Main, (AudioMixerGroup)null);
if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo)
{
EpochMagazine epochMagazine = (EpochMagazine)(object)base.Magazine;
epochMagazine.NumOfRoundsRemaining++;
}
HasStartedCharging = false;
ChargeLoopAudio.pitch = 1f;
}
public void SelfDestruct(FVRViveHand hand)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).EndInteraction(hand);
GameObject[] selfDestructPrefabs = SelfDestructPrefabs;
foreach (GameObject val in selfDestructPrefabs)
{
Object.Instantiate<GameObject>(val, ((Component)this).transform.position, ((Component)this).transform.rotation);
}
((FVRInteractiveObject)this).ForceBreakInteraction();
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public class EpochMagazine : FVRFireArmMagazine
{
[Header("Epoch Cell Params")]
public int NumOfRoundsRemaining = 3;
}
}
namespace Cityrobo
{
public class FirearmEjectAndDeleteMagOnEmpty : MonoBehaviour
{
public FVRFireArm Firearm;
public bool DeleteMagazineEntirely = false;
public void Update()
{
if ((Object)(object)Firearm.Magazine != (Object)null && !Firearm.Magazine.HasARound())
{
FVRFireArmMagazine magazine = Firearm.Magazine;
Firearm.EjectMag(false);
if (DeleteMagazineEntirely)
{
Object.Destroy((Object)(object)((Component)magazine).gameObject);
}
}
}
}
}
namespace ShermanJumbo
{
public class FirearmFlyOutOfHand : MonoBehaviour
{
public FVRFireArm Gun;
public FVRFireArmChamber Chamber;
public float TriggerFloat = 0.85f;
protected bool IsSpent = false;
protected bool WasSpent = false;
public float Force = 30f;
public float Torque = 20f;
private void Update()
{
//IL_00c9: 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_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_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: 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_012e: Unknown result type (might be due to invalid IL or missing references)
IsSpent = Chamber.IsSpent;
if (IsSpent && !WasSpent && (Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null && ((FVRInteractiveObject)Gun).m_hand.Input.TriggerFloat >= TriggerFloat && !Gun.IsTwoHandStabilized() && !Gun.IsForegripStabilized())
{
if ((Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null)
{
((FVRInteractiveObject)Gun).m_hand.EndInteractionIfHeld((FVRInteractiveObject)(object)Gun);
((FVRInteractiveObject)Gun).ForceBreakInteraction();
}
((FVRPhysicalObject)Gun).RootRigidbody.AddForceAtPosition((-((Component)this).transform.forward + ((Component)this).transform.up + Random.onUnitSphere * 0.25f) * Force, Gun.MuzzlePos.position, (ForceMode)1);
((FVRPhysicalObject)Gun).RootRigidbody.AddRelativeTorque(Vector3.right * Torque, (ForceMode)1);
}
WasSpent = Chamber.IsSpent;
}
}
public class FirearmSpinnyBarrels : MonoBehaviour
{
public FVRFireArm Gun;
public GameObject SpinningBarrels;
public float SpinRate;
public dirType DirectionOfSpin;
public float DecelerationRate = 0.5f;
public float TriggerDeadzone = 0.01f;
private float currentSpinSpeed = 0f;
private bool TriggerPulled = false;
public AudioSource SpinnySounds;
public float SpinnySoundsVolume = 0.4f;
private void Awake()
{
if ((Object)(object)SpinnySounds != (Object)null)
{
SpinnySounds.volume = 0f;
}
}
private void Update()
{
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Expected I4, but got Unknown
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)SpinnySounds != (Object)null)
{
SpinnySounds.volume = currentSpinSpeed / SpinRate * SpinnySoundsVolume;
}
if ((Object)(object)Gun != (Object)null && (Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null)
{
float triggerFloat = ((FVRInteractiveObject)Gun).m_hand.Input.TriggerFloat;
if (triggerFloat >= TriggerDeadzone)
{
if (!TriggerPulled)
{
TriggerPulled = true;
}
currentSpinSpeed = SpinRate;
}
else if (TriggerPulled)
{
TriggerPulled = false;
}
}
if (!TriggerPulled && currentSpinSpeed > 0f)
{
currentSpinSpeed -= DecelerationRate * Time.deltaTime;
if (currentSpinSpeed < 0f)
{
currentSpinSpeed = 0f;
}
}
if (currentSpinSpeed > 0f && (Object)(object)SpinningBarrels != (Object)null)
{
Vector3 zero = Vector3.zero;
int num = (int)DirectionOfSpin;
if (num >= 0 && num <= 2)
{
((Vector3)(ref zero))[num] = currentSpinSpeed * Time.deltaTime;
SpinningBarrels.transform.Rotate(zero);
}
else
{
Debug.LogWarning((object)"Invalid DirectionOfSpin value!");
}
}
}
}
public class GrenadeFuseTimeReadout : MonoBehaviour
{
public PinnedGrenade Grenade;
public Text Text;
public bool UseBetterVarTimeFuse = true;
public float[] FuzeTimes;
public float PitchStart = 1f;
public float PitchEnd = 2.5f;
private int FuzeTimeIndex = 0;
private void Update()
{
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
if (Grenade.m_isLeverReleased)
{
float num = Grenade.m_fuseTime;
if (num < 0f)
{
num = 0f;
}
Text.text = num.ToString("F1") + "s";
if (UseBetterVarTimeFuse)
{
float num2 = Mathf.Clamp(1f - Grenade.m_fuseTime / Grenade.m_startFuseTime, 0f, 1f);
num2 = Mathf.Pow(num2, 2f);
if (Grenade.m_fuse_tick <= 0f)
{
Grenade.m_fuse_tick = Mathf.Lerp(Grenade.m_fuse_StartRefire, Grenade.m_fuse_EndRefire, num2);
float num3 = Mathf.Lerp(PitchStart, PitchEnd, num2);
SM.PlayCoreSoundOverrides((FVRPooledAudioType)0, Grenade.AudEvent_FusePulse, ((FVRInteractiveObject)Grenade).Transform.position, new Vector2(1f, 1f), new Vector2(num3, num3));
Grenade.FusePSystem.Emit(2);
}
else
{
PinnedGrenade grenade = Grenade;
grenade.m_fuse_tick -= Time.deltaTime;
}
}
}
if (!UseBetterVarTimeFuse)
{
return;
}
if ((Object)(object)((FVRInteractiveObject)Grenade).m_hand != (Object)null && ((((FVRInteractiveObject)Grenade).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)Grenade).m_hand.Input.BYButtonDown) || (((FVRInteractiveObject)Grenade).m_hand.Input.TouchpadDown && ((Vector2)(ref ((FVRInteractiveObject)Grenade).m_hand.Input.TouchpadAxes)).magnitude > 0.2f && Vector2.Angle(((FVRInteractiveObject)Grenade).m_hand.Input.TouchpadAxes, Vector2.up) <= 45f)))
{
if (FuzeTimeIndex < FuzeTimes.Length - 1)
{
FuzeTimeIndex++;
}
else
{
FuzeTimeIndex = 0;
}
}
Grenade.DefaultFuse.x = FuzeTimes[FuzeTimeIndex];
Grenade.DefaultFuse.y = FuzeTimes[FuzeTimeIndex];
if (!Grenade.m_isLeverReleased)
{
float num4 = FuzeTimes[FuzeTimeIndex];
Grenade.DefaultFuse.x = num4;
Grenade.DefaultFuse.y = num4;
Grenade.m_startFuseTime = num4;
Grenade.m_fuseTime = num4;
Text.text = num4.ToString("F1") + "s";
}
}
}
}
namespace BitWizrd.GrenadeMod
{
public class GrenadeMod : FVRPhysicalObject
{
[Header("Grenade Settings")]
public GameObject grenadeGameObject;
public PinnedGrenadeRing pinnedGrenadeRing;
public Rigidbody grenadeRigidbody;
public bool activateLeverOnPinPull = false;
[Header("Sticky Grenade Settings")]
public bool isStickyGrenade = true;
public Collider stickyCollider;
public float stickingDistance = 0.1f;
public LayerMask stickyLayers;
public float embeddingDistance = 0.02f;
public bool playStickSoundForRigidbodiesOnly = true;
public AudioSource stickSoundSource;
public AudioClip[] stickSounds;
public float minimumStickVelocity = 2f;
public float regrabActivationDelay = 0.5f;
public float massWhileStuck = 10f;
[Header("Grenade Cooking Settings")]
public GameObject pinPullEffectPrefab;
public AudioSource cookingAudioSource;
public AudioClip[] cookingClips;
public float cookingSoundDelay = 1f;
[Header("Grenade Fast Throw Settings")]
public AudioSource fastThrowAudioSource;
public AudioClip[] fastThrowClips;
public float fastThrowVelocityThreshold = 10f;
public float releaseWindow = 0.5f;
private PinnedGrenade grenade;
private Collider grenadeCollider;
private bool hasPlayedFastThrowSound = false;
private bool isPinPulled = false;
private bool isHeld = false;
private bool wasHeld = false;
private bool pinPulledChecked = false;
private bool shouldCheckVelocity = false;
private bool hasReleasedLever = false;
private bool isSticking = false;
private bool canStick = false;
private float timeSinceRelease = 0f;
private GameObject parentObject;
private Vector3 savedPosition;
private Quaternion savedRotation;
private Vector3 savedScale;
private FVRInteractiveObject interactiveObject;
private bool isCookingCoroutineRunning = false;
private void Start()
{
interactiveObject = ((Component)this).GetComponent<FVRInteractiveObject>();
}
public override void FVRUpdate()
{
((FVRPhysicalObject)this).FVRUpdate();
if ((Object)(object)grenadeGameObject == (Object)null)
{
return;
}
grenade = grenadeGameObject.GetComponent<PinnedGrenade>();
if ((Object)(object)grenade == (Object)null)
{
return;
}
FVRPhysicalObject component = grenadeGameObject.GetComponent<FVRPhysicalObject>();
if ((Object)(object)component == (Object)null)
{
return;
}
grenadeCollider = grenadeGameObject.GetComponent<Collider>();
if ((Object)(object)grenadeCollider == (Object)null)
{
return;
}
isHeld = ((FVRInteractiveObject)component).IsHeld;
if ((Object)(object)pinnedGrenadeRing != (Object)null)
{
isPinPulled = pinnedGrenadeRing.HasPinDetached();
if (!pinPulledChecked && isPinPulled)
{
pinPulledChecked = true;
shouldCheckVelocity = true;
if (isStickyGrenade)
{
EnableStickyCollider();
}
if ((Object)(object)pinPullEffectPrefab != (Object)null)
{
pinPullEffectPrefab.SetActive(true);
}
}
if (!wasHeld && isHeld)
{
hasPlayedFastThrowSound = false;
timeSinceRelease = 0f;
if (isPinPulled)
{
EnableStickyCollider();
}
shouldCheckVelocity = isPinPulled;
wasHeld = true;
canStick = true;
isSticking = false;
FixedJoint component2 = ((Component)this).GetComponent<FixedJoint>();
if ((Object)(object)component2 != (Object)null)
{
Object.Destroy((Object)(object)component2);
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.detectCollisions = true;
grenadeRigidbody.useGravity = true;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
Debug.Log((object)"FixedJoint grenade unstuck upon being picked up.");
}
else if ((Object)(object)((Component)this).transform.parent != (Object)null && ((Object)((Component)((Component)this).transform.parent).gameObject).name == "DummyParent")
{
GameObject gameObject = ((Component)((Component)this).transform.parent).gameObject;
((Component)this).transform.SetParent((Transform)null, true);
Object.Destroy((Object)(object)gameObject);
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.detectCollisions = true;
grenadeRigidbody.useGravity = true;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
Debug.Log((object)"Static-stuck grenade unstuck upon being picked up.");
}
if (isStickyGrenade)
{
DisableStickyColliderTemporarily();
}
}
if (wasHeld && !isHeld)
{
isSticking = false;
wasHeld = false;
}
}
if (isPinPulled || !isHeld)
{
DisableMeleeDamage(component);
}
else
{
EnableMeleeDamage(component);
}
if (isPinPulled && !cookingAudioSource.isPlaying && cookingClips.Length > 0 && !isCookingCoroutineRunning)
{
if (cookingSoundDelay == 0f)
{
PlayCookingSoundImmediately();
}
else
{
((MonoBehaviour)this).StartCoroutine(HandleCookingSoundDelay());
}
}
if (isPinPulled && (Object)(object)pinPullEffectPrefab != (Object)null)
{
pinPullEffectPrefab.SetActive(true);
}
if (isPinPulled && activateLeverOnPinPull && !hasReleasedLever)
{
grenade.ReleaseLever();
hasReleasedLever = true;
}
}
public override void FVRFixedUpdate()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_009a: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).FVRFixedUpdate();
if (shouldCheckVelocity && isHeld)
{
Vector3 velocity = grenadeRigidbody.velocity;
if (((Vector3)(ref velocity)).magnitude >= minimumStickVelocity)
{
canStick = true;
}
else
{
canStick = false;
}
}
if (!shouldCheckVelocity || isHeld)
{
return;
}
timeSinceRelease += Time.fixedDeltaTime;
if (timeSinceRelease <= releaseWindow)
{
Vector3 velocity2 = grenadeRigidbody.velocity;
if (((Vector3)(ref velocity2)).magnitude > fastThrowVelocityThreshold && !hasPlayedFastThrowSound)
{
PlayFastThrowSound();
}
}
else
{
shouldCheckVelocity = false;
}
}
private void DisableMeleeDamage(FVRPhysicalObject physicalObject)
{
if (physicalObject.MP != null && physicalObject.MP.IsMeleeWeapon)
{
physicalObject.MP.IsMeleeWeapon = false;
}
}
private void EnableMeleeDamage(FVRPhysicalObject physicalObject)
{
if (physicalObject.MP != null && !physicalObject.MP.IsMeleeWeapon)
{
physicalObject.MP.IsMeleeWeapon = true;
}
}
private void PlayFastThrowSound()
{
if (fastThrowClips.Length > 0 && (Object)(object)fastThrowAudioSource != (Object)null)
{
AudioClip val = fastThrowClips[Random.Range(0, fastThrowClips.Length)];
fastThrowAudioSource.PlayOneShot(val);
}
hasPlayedFastThrowSound = true;
}
private void OnCollisionEnter(Collision collision)
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
if (!isPinPulled || isSticking || !isStickyGrenade || !((Object)(object)stickyCollider != (Object)null) || (Object)(object)collision.gameObject.GetComponent<BreakableGlass>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenade>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenadePin>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<SosigWeapon>() != (Object)null)
{
return;
}
ContactPoint[] contacts = collision.contacts;
for (int i = 0; i < contacts.Length; i++)
{
ContactPoint contact = contacts[i];
if (!((Object)(object)((ContactPoint)(ref contact)).thisCollider == (Object)(object)stickyCollider))
{
continue;
}
if ((LayerMask.op_Implicit(stickyLayers) & (1 << collision.gameObject.layer)) == 0 || !IsContactPointWithinStickingDistance(((ContactPoint)(ref contact)).point))
{
break;
}
isSticking = true;
StickToSurface(collision, contact);
PlayStickingSound(collision);
parentObject = collision.gameObject;
if ((Object)(object)parentObject != (Object)null)
{
DestroyNotifier destroyNotifier = parentObject.GetComponent<DestroyNotifier>();
if ((Object)(object)destroyNotifier == (Object)null)
{
destroyNotifier = parentObject.AddComponent<DestroyNotifier>();
}
destroyNotifier.OnDestroyed += OnDestroyUnstickGrenade;
}
break;
}
}
private bool IsContactPointWithinStickingDistance(Vector3 contactPoint)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = stickyCollider.ClosestPoint(contactPoint);
float num = Vector3.Distance(contactPoint, val);
return num < stickingDistance;
}
private void StickToSurface(Collision collision, ContactPoint contact)
{
//IL_004c: 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)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Expected O, but got Unknown
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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)
if ((Object)(object)stickyCollider == (Object)null)
{
return;
}
if ((Object)(object)interactiveObject != (Object)null && interactiveObject.IsHeld)
{
interactiveObject.ForceBreakInteraction();
}
savedPosition = ((Component)this).transform.position;
savedRotation = ((Component)this).transform.rotation;
Vector3 lossyScale = ((Component)this).transform.lossyScale;
Rigidbody rigidbody = collision.rigidbody;
Vector3 val = ((ContactPoint)(ref contact)).normal * embeddingDistance;
if ((Object)(object)rigidbody != (Object)null)
{
((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val;
FixedJoint component = ((Component)this).GetComponent<FixedJoint>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
FixedJoint val2 = ((Component)this).gameObject.AddComponent<FixedJoint>();
((Joint)val2).connectedBody = rigidbody;
((Joint)val2).breakForce = float.MaxValue;
((Joint)val2).breakTorque = float.MaxValue;
grenadeRigidbody.useGravity = false;
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
grenadeRigidbody.mass = massWhileStuck;
SetCollidersToLayer(stickyCollider, "NoCol");
}
else
{
GameObject val3 = new GameObject("DummyParent");
val3.transform.position = ((ContactPoint)(ref contact)).point;
val3.transform.rotation = collision.transform.rotation;
grenadeRigidbody.isKinematic = true;
val3.transform.SetParent(collision.transform, true);
((Component)this).transform.SetParent(val3.transform, false);
((Component)this).transform.localScale = new Vector3(lossyScale.x / ((Component)this).transform.lossyScale.x, lossyScale.y / ((Component)this).transform.lossyScale.y, lossyScale.z / ((Component)this).transform.lossyScale.z);
((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val;
((Component)this).transform.rotation = savedRotation;
}
}
private void EnableStickyCollider()
{
if ((Object)(object)stickyCollider != (Object)null)
{
stickyCollider.enabled = true;
}
}
private void DisableStickyColliderTemporarily()
{
if ((Object)(object)stickyCollider != (Object)null)
{
stickyCollider.enabled = false;
}
((MonoBehaviour)this).StartCoroutine(ReenableStickyColliderAfterDelay());
}
private IEnumerator ReenableStickyColliderAfterDelay()
{
yield return (object)new WaitForSeconds(regrabActivationDelay);
EnableStickyCollider();
}
private void PlayStickingSound(Collision collision)
{
if ((Object)(object)stickSoundSource != (Object)null && stickSounds.Length > 0 && ((playStickSoundForRigidbodiesOnly && (Object)(object)collision.rigidbody != (Object)null) || !playStickSoundForRigidbodiesOnly))
{
int num = Random.Range(0, stickSounds.Length);
stickSoundSource.clip = stickSounds[num];
stickSoundSource.Play();
}
}
private void OnDestroyUnstickGrenade()
{
if ((Object)(object)this == (Object)null)
{
return;
}
if ((Object)(object)parentObject != (Object)null)
{
DestroyNotifier component = parentObject.GetComponent<DestroyNotifier>();
if ((Object)(object)component != (Object)null)
{
component.OnDestroyed -= OnDestroyUnstickGrenade;
}
parentObject = null;
}
FixedJoint component2 = ((Component)this).GetComponent<FixedJoint>();
if ((Object)(object)component2 != (Object)null)
{
Object.Destroy((Object)(object)component2);
}
else if ((Object)(object)((Component)this).transform.parent != (Object)null)
{
((Component)this).transform.SetParent((Transform)null);
}
if ((Object)(object)grenadeRigidbody != (Object)null)
{
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.detectCollisions = true;
grenadeRigidbody.useGravity = true;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
}
isSticking = false;
if ((Object)(object)stickyCollider != (Object)null)
{
stickyCollider.enabled = false;
}
canStick = false;
}
private void SetCollidersToLayer(Collider collider, string layer)
{
((Component)collider).gameObject.layer = LayerMask.NameToLayer(layer);
}
private IEnumerator HandleCookingSoundDelay()
{
isCookingCoroutineRunning = true;
if (cookingSoundDelay > 0f)
{
yield return (object)new WaitForSeconds(cookingSoundDelay);
}
if ((Object)(object)cookingAudioSource != (Object)null && cookingClips.Length > 0)
{
int num = Random.Range(0, cookingClips.Length);
cookingAudioSource.clip = cookingClips[num];
cookingAudioSource.Play();
}
isCookingCoroutineRunning = false;
}
private void PlayCookingSoundImmediately()
{
if ((Object)(object)cookingAudioSource != (Object)null && cookingClips.Length > 0)
{
int num = Random.Range(0, cookingClips.Length);
cookingAudioSource.clip = cookingClips[num];
cookingAudioSource.Play();
}
}
private void OnDestroy()
{
if ((Object)(object)parentObject != (Object)null)
{
DestroyNotifier component = parentObject.GetComponent<DestroyNotifier>();
if ((Object)(object)component != (Object)null)
{
component.OnDestroyed -= OnDestroyUnstickGrenade;
}
}
}
}
public class DestroyNotifier : MonoBehaviour
{
public delegate void DestroyedAction();
public event DestroyedAction OnDestroyed;
private void OnDestroy()
{
if (this.OnDestroyed != null)
{
this.OnDestroyed();
}
}
}
}
namespace ShermanJumbo
{
public class GrenadeParticlesIfArmed : MonoBehaviour
{
public PinnedGrenade Grenade;
public ParticleSystem[] Particles;
public AudioSource ArmedSounds;
public bool ReleaseLeverOnPinPull = true;
private bool m_hasReleasedLever = false;
private bool m_hasArmed = false;
private bool m_hasExploded = false;
private void Start()
{
StopParticles();
ArmedSounds.Stop();
}
private void Update()
{
if ((Object)(object)Grenade == (Object)null || Particles == null || (Object)(object)ArmedSounds == (Object)null)
{
return;
}
bool isPinPulled = Grenade.m_isPinPulled;
bool isLeverReleased = Grenade.m_isLeverReleased;
bool hasSploded = Grenade.m_hasSploded;
if (ReleaseLeverOnPinPull && isPinPulled && !m_hasReleasedLever)
{
m_hasReleasedLever = true;
Grenade.ReleaseLever();
}
if (isLeverReleased && !m_hasArmed)
{
m_hasArmed = true;
PlayParticles();
if (!ArmedSounds.isPlaying)
{
ArmedSounds.Play();
}
}
if (hasSploded && !m_hasExploded)
{
m_hasExploded = true;
StopParticles();
if (ArmedSounds.isPlaying)
{
ArmedSounds.Stop();
}
}
}
private void PlayParticles()
{
if (Particles == null)
{
return;
}
ParticleSystem[] particles = Particles;
foreach (ParticleSystem val in particles)
{
if ((Object)(object)val != (Object)null && !val.isPlaying)
{
val.Play();
}
}
}
private void StopParticles()
{
if (Particles == null)
{
return;
}
ParticleSystem[] particles = Particles;
foreach (ParticleSystem val in particles)
{
if ((Object)(object)val != (Object)null && val.isPlaying)
{
val.Stop();
}
}
}
}
public class GrenadeTouchpadArm : MonoBehaviour
{
public PinnedGrenade Grenade;
private FVRViveHand Hand;
private void Update()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
Hand = ((FVRInteractiveObject)Grenade).m_hand;
if ((Object)(object)Hand == (Object)null)
{
return;
}
Vector2 touchpadAxes = Hand.Input.TouchpadAxes;
if ((!Hand.IsInStreamlinedMode || !Hand.Input.AXButtonPressed) && (!Hand.Input.TouchpadPressed || !(((Vector2)(ref touchpadAxes)).magnitude > 0.2f) || !(Vector2.Angle(touchpadAxes, Vector2.down) <= 45f)))
{
return;
}
foreach (PinnedGrenadeRing ring in Grenade.m_rings)
{
ring.PopOutRoutine();
}
Grenade.ReleaseLever();
}
}
public class LAPDLaserAsAttachment : MonoBehaviour
{
public LAPD2019Laser Laser;
private void Awake()
{
Laser.m_isOn = true;
}
}
}
namespace DigitalRuby.LightningBolt
{
public enum LightningBoltAnimationMode
{
None,
Random,
Loop,
PingPong
}
[RequireComponent(typeof(LineRenderer))]
public class LightningBoltScript : MonoBehaviour
{
[Tooltip("The game object where the lightning will emit from. If null, StartPosition is used.")]
public GameObject StartObject;
[Tooltip("The start position where the lightning will emit from. This is in world space if StartObject is null, otherwise this is offset from StartObject position.")]
public Vector3 StartPosition;
[Tooltip("The game object where the lightning will end at. If null, EndPosition is used.")]
public GameObject EndObject;
[Tooltip("The end position where the lightning will end at. This is in world space if EndObject is null, otherwise this is offset from EndObject position.")]
public Vector3 EndPosition;
[Range(0f, 8f)]
[Tooltip("How manu generations? Higher numbers create more line segments.")]
public int Generations = 6;
[Range(0.01f, 1f)]
[Tooltip("How long each bolt should last before creating a new bolt. In ManualMode, the bolt will simply disappear after this amount of seconds.")]
public float Duration = 0.05f;
private float timer;
[Range(0f, 1f)]
[Tooltip("How chaotic should the lightning be? (0-1)")]
public float ChaosFactor = 0.15f;
[Tooltip("In manual mode, the trigger method must be called to create a bolt")]
public bool ManualMode;
[Range(1f, 64f)]
[Tooltip("The number of rows in the texture. Used for animation.")]
public int Rows = 1;
[Range(1f, 64f)]
[Tooltip("The number of columns in the texture. Used for animation.")]
public int Columns = 1;
[Tooltip("The animation mode for the lightning")]
public LightningBoltAnimationMode AnimationMode = LightningBoltAnimationMode.PingPong;
[NonSerialized]
[HideInInspector]
public Random RandomGenerator = new Random();
private LineRenderer lineRenderer;
private List<KeyValuePair<Vector3, Vector3>> segments = new List<KeyValuePair<Vector3, Vector3>>();
private int startIndex;
private Vector2 size;
private Vector2[] offsets;
private int animationOffsetIndex;
private int animationPingPongDirection = 1;
private bool orthographic;
private void GetPerpendicularVector(ref Vector3 directionNormalized, out Vector3 side)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
if (directionNormalized == Vector3.zero)
{
side = Vector3.right;
return;
}
float x = directionNormalized.x;
float y = directionNormalized.y;
float z = directionNormalized.z;
float num = Mathf.Abs(x);
float num2 = Mathf.Abs(y);
float num3 = Mathf.Abs(z);
float num4;
float num5;
float num6;
if (num >= num2 && num2 >= num3)
{
num4 = 1f;
num5 = 1f;
num6 = (0f - (y * num4 + z * num5)) / x;
}
else if (num2 >= num3)
{
num6 = 1f;
num5 = 1f;
num4 = (0f - (x * num6 + z * num5)) / y;
}
else
{
num6 = 1f;
num4 = 1f;
num5 = (0f - (x * num6 + y * num4)) / z;
}
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(num6, num4, num5);
side = ((Vector3)(ref val)).normalized;
}
private void GenerateLightningBolt(Vector3 start, Vector3 end, int generation, int totalGenerations, float offsetAmount)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
if (generation < 0 || generation > 8)
{
return;
}
if (orthographic)
{
start.z = (end.z = Mathf.Min(start.z, end.z));
}
segments.Add(new KeyValuePair<Vector3, Vector3>(start, end));
if (generation == 0)
{
return;
}
if (offsetAmount <= 0f)
{
Vector3 val = end - start;
offsetAmount = ((Vector3)(ref val)).magnitude * ChaosFactor;
}
while (generation-- > 0)
{
int num = startIndex;
startIndex = segments.Count;
for (int i = num; i < startIndex; i++)
{
start = segments[i].Key;
end = segments[i].Value;
Vector3 val2 = (start + end) * 0.5f;
RandomVector(ref start, ref end, offsetAmount, out var result);
val2 += result;
segments.Add(new KeyValuePair<Vector3, Vector3>(start, val2));
segments.Add(new KeyValuePair<Vector3, Vector3>(val2, end));
}
offsetAmount *= 0.5f;
}
}
public void RandomVector(ref Vector3 start, ref Vector3 end, float offsetAmount, out Vector3 result)
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_000e: 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_001e: 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_0026: 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_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)
if (orthographic)
{
Vector3 val = end - start;
Vector3 normalized = ((Vector3)(ref val)).normalized;
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(0f - normalized.y, normalized.x, normalized.z);
float num = (float)RandomGenerator.NextDouble() * offsetAmount * 2f - offsetAmount;
result = val2 * num;
}
else
{
Vector3 val3 = end - start;
Vector3 directionNormalized = ((Vector3)(ref val3)).normalized;
GetPerpendicularVector(ref directionNormalized, out var side);
float num2 = ((float)RandomGenerator.NextDouble() + 0.1f) * offsetAmount;
float num3 = (float)RandomGenerator.NextDouble() * 360f;
result = Quaternion.AngleAxis(num3, directionNormalized) * side * num2;
}
}
private void SelectOffsetFromAnimationMode()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: 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 (AnimationMode == LightningBoltAnimationMode.None)
{
((Renderer)lineRenderer).material.mainTextureOffset = offsets[0];
return;
}
int num;
if (AnimationMode == LightningBoltAnimationMode.PingPong)
{
num = animationOffsetIndex;
animationOffsetIndex += animationPingPongDirection;
if (animationOffsetIndex >= offsets.Length)
{
animationOffsetIndex = offsets.Length - 2;
animationPingPongDirection = -1;
}
else if (animationOffsetIndex < 0)
{
animationOffsetIndex = 1;
animationPingPongDirection = 1;
}
}
else if (AnimationMode == LightningBoltAnimationMode.Loop)
{
num = animationOffsetIndex++;
if (animationOffsetIndex >= offsets.Length)
{
animationOffsetIndex = 0;
}
}
else
{
num = RandomGenerator.Next(0, offsets.Length);
}
if (num >= 0 && num < offsets.Length)
{
((Renderer)lineRenderer).material.mainTextureOffset = offsets[num];
}
else
{
((Renderer)lineRenderer).material.mainTextureOffset = offsets[0];
}
}
private void UpdateLineRenderer()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
int num = segments.Count - startIndex + 1;
lineRenderer.positionCount = num;
if (num >= 1)
{
int num2 = 0;
lineRenderer.SetPosition(num2++, segments[startIndex].Key);
for (int i = startIndex; i < segments.Count; i++)
{
lineRenderer.SetPosition(num2++, segments[i].Value);
}
segments.Clear();
SelectOffsetFromAnimationMode();
}
}
private void Start()
{
orthographic = (Object)(object)Camera.main != (Object)null && Camera.main.orthographic;
lineRenderer = ((Component)this).GetComponent<LineRenderer>();
lineRenderer.positionCount = 0;
UpdateFromMaterialChange();
}
private void Update()
{
orthographic = (Object)(object)Camera.main != (Object)null && Camera.main.orthographic;
if (timer <= 0f)
{
if (ManualMode)
{
timer = Duration;
lineRenderer.positionCount = 0;
}
else
{
Trigger();
}
}
timer -= Time.deltaTime;
}
public void Trigger()
{
//IL_0049: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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_0036: 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)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
timer = Duration + Mathf.Min(0f, timer);
Vector3 start = ((!((Object)(object)StartObject == (Object)null)) ? (StartObject.transform.position + StartPosition) : StartPosition);
Vector3 end = ((!((Object)(object)EndObject == (Object)null)) ? (EndObject.transform.position + EndPosition) : EndPosition);
startIndex = 0;
GenerateLightningBolt(start, end, Generations, Generations, 0f);
UpdateLineRenderer();
}
public void UpdateFromMaterialChange()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: 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)
size = new Vector2(1f / (float)Columns, 1f / (float)Rows);
((Renderer)lineRenderer).material.mainTextureScale = size;
offsets = (Vector2[])(object)new Vector2[Rows * Columns];
for (int i = 0; i < Rows; i++)
{
for (int j = 0; j < Columns; j++)
{
ref Vector2 reference = ref offsets[j + i * Columns];
reference = new Vector2((float)j / (float)Columns, (float)i / (float)Rows);
}
}
}
}
}
namespace ShermanJumbo
{
public class MagazineDeleteIfEmpty : MonoBehaviour
{
public FVRFireArmMagazine Magazine;
private void Update()
{
if (!((Object)(object)Magazine.FireArm == (Object)null) && !Magazine.HasARound())
{
FVRFireArmMagazine magazine = Magazine;
Magazine.FireArm.EjectMag(false);
Object.Destroy((Object)(object)((Component)magazine).gameObject);
}
}
}
}
namespace MeatKit
{
public class HideInNormalInspectorAttribute : PropertyAttribute
{
}
}
namespace ShermanJumbo.Wrist_Wrecker_5000
{
[BepInPlugin("ShermanJumbo.Wrist_Wrecker_5000", "Wrist_Wrecker_5000", "0.0.1")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Wrist_Wrecker_5000Plugin : 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(), "ShermanJumbo.Wrist_Wrecker_5000");
OtherLoader.RegisterDirectLoad(BasePath, "ShermanJumbo.Wrist_Wrecker_5000", "", "", "shermanjumbo_wristwrecker5000", "");
}
}
}
namespace ShermanJumbo
{
public class MinigunExtraBarrelVisual : MonoBehaviour
{
public Minigun Minigun;
public Transform Barrel;
private void Update()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
Barrel.localEulerAngles = new Vector3(0f, 0f, Minigun.m_foreRot);
}
}
}
public class MinigunMultipleMuzzles : MonoBehaviour
{
public Minigun Minigun;
private int CurrentRoundCount;
private int PreviousRoundCount;
public Transform[] Muzzles;
private int MuzzleIndex;
private void Update()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
MinigunBox val = (MinigunBox)((FVRFireArm)Minigun).Magazine;
if ((Object)(object)val == (Object)null)
{
return;
}
CurrentRoundCount = val.NumBulletsLeft;
if (CurrentRoundCount < PreviousRoundCount)
{
MuzzleIndex++;
if (MuzzleIndex > Muzzles.Length - 1)
{
MuzzleIndex = 0;
}
((FVRFireArm)Minigun).MuzzlePos = Muzzles[MuzzleIndex];
((FVRFireArm)Minigun).UpdateCurrentMuzzle();
}
PreviousRoundCount = CurrentRoundCount;
}
}
namespace ShermanJumbo
{
public class OpenBoltFakeChamberDisplay : MonoBehaviour
{
public OpenBoltReceiver Gun;
public OpenBoltReceiverBolt Bolt;
public GameObject DisplayRound;
private void Update()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Invalid comparison between Unknown and I4
if ((Object)(object)((FVRFireArm)Gun).Magazine != (Object)null && ((FVRFireArm)Gun).Magazine.HasARound() && (int)Bolt.CurPos != 0 && (int)Bolt.CurPos != 1)
{
DisplayRound.SetActive(true);
}
else
{
DisplayRound.SetActive(false);
}
}
}
public class DoubleBarrelClosedBoltWeaponBolt : FVRInteractiveObject
{
public enum BoltPos
{
Forward,
ForwardToMid,
Locked,
LockedToRear,
Rear
}
[Header("Bolt")]
public DoubleBarreledClosedBoltWeapon Weapon;
public float Speed_Forward;
public float Speed_Rearward;
public float Speed_Held;
public float SpringStiffness = 5f;
public BoltPos CurPos;
public BoltPos LastPos;
public Transform Point_Bolt_Forward;
public Transform Point_Bolt_LockPoint;
public Transform Point_Bolt_Rear;
public Transform Point_Bolt_SafetyLock;
public bool HasLastRoundBoltHoldOpen = true;
public bool UsesAKSafetyLock;
public bool DoesClipHoldBoltOpen = true;
private float m_curBoltSpeed;
private float m_boltZ_current;
private float m_boltZ_heldTarget;
private float m_boltZ_forward;
private float m_boltZ_lock;
private float m_boltZ_rear;
private float m_boltZ_safetylock;
private bool m_isBoltLocked;
private bool m_isHandleHeld;
private float m_handleLerp;
public bool HasBoltCatchReleaseButton;
private bool m_isBoltCatchHeldOnHandle;
private bool m_isReleaseCatchHeldOnHandle;
[Header("Reciprocating Barrel")]
public bool HasReciprocatingBarrel;
public Transform Barrel;
public Vector3 BarrelForward;
public Vector3 BarrelRearward;
private bool m_isBarrelReciprocating;
[Header("Hammer")]
public bool HasHammer;
public Transform Hammer;
public Vector3 HammerForward;
public Vector3 HammerRearward;
[Header("Rotating Bit")]
public bool HasRotatingPart;
public Transform RotatingPart;
public Vector3 RotatingPartNeutralEulers;
public Vector3 RotatingPartLeftEulers;
public Vector3 RotatingPartRightEulers;
[Header("Z Rot Part")]
public bool HasZRotPart;
public Transform ZRotPiece;
public AnimationCurve ZRotCurve;
public Vector2 ZAngles;
public bool ZRotPieceDips;
public float DipMagnitude;
public bool ZRotPieceLags;
public float LagMagnitude;
[Header("Z Scale Part")]
public bool HasZScalePart;
public Transform ZScalePiece;
public AnimationCurve ZScaleCurve;
public override void Awake()
{
//IL_000e: 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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).Awake();
m_boltZ_current = ((Component)this).transform.localPosition.z;
m_boltZ_forward = Point_Bolt_Forward.localPosition.z;
m_boltZ_lock = Point_Bolt_LockPoint.localPosition.z;
m_boltZ_rear = Point_Bolt_Rear.localPosition.z;
if (UsesAKSafetyLock)
{
m_boltZ_safetylock = Point_Bolt_SafetyLock.localPosition.z;
}
}
public float GetBoltLerpBetweenLockAndFore()
{
return Mathf.InverseLerp(m_boltZ_lock, m_boltZ_forward, m_boltZ_current);
}
public float GetBoltLerpBetweenRearAndFore()
{
return Mathf.InverseLerp(m_boltZ_rear, m_boltZ_forward, m_boltZ_current);
}
public void LockBolt()
{
if (!m_isBoltLocked)
{
m_isBoltLocked = true;
}
}
public void ReleaseBolt()
{
if (m_isBoltLocked)
{
if (!((FVRInteractiveObject)this).IsHeld)
{
((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)8, 1f);
}
m_isBoltLocked = false;
}
}
public void SnapToRear()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
CurPos = BoltPos.Rear;
m_boltZ_current = m_boltZ_rear;
((Component)this).transform.localPosition = Point_Bolt_Rear.localPosition;
}
public bool IsBoltLocked()
{
return m_isBoltLocked;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_001a: 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_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_0037: 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_003d: 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_0078: 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_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).UpdateInteraction(hand);
if (HasRotatingPart)
{
Vector3 val = ((Component)this).transform.position - base.m_hand.PalmTransform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
if (Vector3.Dot(normalized, ((Component)this).transform.right) > 0f)
{
RotatingPart.localEulerAngles = RotatingPartLeftEulers;
}
else
{
RotatingPart.localEulerAngles = RotatingPartRightEulers;
}
}
if (hand.IsInStreamlinedMode)
{
if (hand.Input.AXButtonDown && HasBoltCatchReleaseButton)
{
m_isBoltCatchHeldOnHandle = true;
((FVRInteractiveObject)this).ForceBreakInteraction();
}
else if (hand.Input.BYButtonDown && HasBoltCatchReleaseButton)
{
m_isReleaseCatchHeldOnHandle = true;
((FVRInteractiveObject)this).ForceBreakInteraction();
}
}
else if (hand.Input.TouchpadDown)
{
if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) < 45f && HasBoltCatchReleaseButton)
{
m_isBoltCatchHeldOnHandle = true;
((FVRInteractiveObject)this).ForceBreakInteraction();
}
else if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f && HasBoltCatchReleaseButton)
{
m_isReleaseCatchHeldOnHandle = true;
((FVRInteractiveObject)this).ForceBreakInteraction();
}
}
}
public override void EndInteraction(FVRViveHand hand)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (HasRotatingPart)
{
RotatingPart.localEulerAngles = RotatingPartNeutralEulers;
}
if (!m_isBoltLocked)
{
m_curBoltSpeed = Speed_Forward;
}
if (CurPos > BoltPos.Forward)
{
((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)8, 1f);
}
if (m_isBoltCatchHeldOnHandle)
{
m_isBoltCatchHeldOnHandle = false;
if (CurPos >= BoltPos.Locked)
{
LockBolt();
}
}
if (m_isReleaseCatchHeldOnHandle)
{
m_isReleaseCatchHeldOnHandle = false;
ReleaseBolt();
}
((FVRInteractiveObject)this).EndInteraction(hand);
}
public void UpdateHandleHeldState(bool state, float lerp)
{
m_isHandleHeld = state;
if (state)
{
m_handleLerp = lerp;
}
}
public void ImpartFiringImpulse()
{
m_curBoltSpeed = Speed_Rearward;
if (CurPos == BoltPos.Forward)
{
m_isBarrelReciprocating = true;
}
}
public bool IsBoltForwardOfSafetyLock()
{
return m_boltZ_current > m_boltZ_safetylock;
}
public void UpdateBolt()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//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_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: 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_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0461: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
if (((FVRInteractiveObject)this).IsHeld || m_isHandleHeld)
{
flag = true;
}
if (((FVRInteractiveObject)this).IsHeld)
{
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Bolt_Forward.position, Point_Bolt_Rear.position, ((HandInput)(ref base.m_hand.Input)).Pos);
m_boltZ_heldTarget = ((Component)Weapon).transform.InverseTransformPoint(closestValidPoint).z;
}
else if (m_isHandleHeld)
{
m_boltZ_heldTarget = Mathf.Lerp(m_boltZ_forward, m_boltZ_rear, m_handleLerp);
}
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(m_boltZ_rear,using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using OtherLoader;
[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]
namespace WickedBadger.HK_437;
[BepInPlugin("WickedBadger.HK_437", "HK_437", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HK_437Plugin : 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(), "WickedBadger.HK_437");
OtherLoader.RegisterDirectLoad(BasePath, "WickedBadger.HK_437", "", "", "h3vr.wickedbadger.hk437", "");
}
}using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;
[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 FlickerLight : MonoBehaviour
{
public float MinLightIntensity = 0.5f;
public float MaxLightIntensity = 2.3f;
public float AccelerateTime = 0.15f;
private float _targetIntensity = 1f;
private float _lastIntensity = 1f;
private float _timePassed = 0f;
private Light _lt;
private const double Tolerance = 0.0001;
private void Start()
{
_lt = ((Component)this).GetComponent<Light>();
_lastIntensity = _lt.intensity;
FixedUpdate();
}
private void FixedUpdate()
{
_timePassed += Time.deltaTime;
_lt.intensity = Mathf.Lerp(_lastIntensity, _targetIntensity, _timePassed / AccelerateTime);
if ((double)Mathf.Abs(_lt.intensity - _targetIntensity) < 0.0001)
{
_lastIntensity = _lt.intensity;
_targetIntensity = Random.Range(MinLightIntensity, MaxLightIntensity);
_timePassed = 0f;
}
}
}
[RequireComponent(typeof(MeshRenderer))]
public class UVOffset : MonoBehaviour
{
public float scrollSpeed = 0.5f;
public bool scrollY = true;
private MeshRenderer renderer;
private void Start()
{
renderer = ((Component)this).GetComponent<MeshRenderer>();
}
private void Update()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
float num = Time.time * scrollSpeed;
((Renderer)renderer).material.SetTextureOffset("_MainTex", (!scrollY) ? new Vector2(0f, num) : new Vector2(num, 0f));
}
}
namespace Storymods.TheColdWarFamily;
[BepInPlugin("Storymods.TheColdWarFamily", "TheColdWarFamily", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class TheColdWarFamilyPlugin : 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(), "Storymods.TheColdWarFamily");
OtherLoader.RegisterDirectLoad(BasePath, "Storymods.TheColdWarFamily", "", "", "storymods_the cold war", "");
}
}
public class Cabernade : MonoBehaviour
{
public GameObject caberUnexploded;
public GameObject caberExploded;
public bool isCaberKablooey;
public void OnCollisionEnter(Collision col)
{
if (!isCaberKablooey)
{
CaberBlowUp();
}
}
public void CaberBlowUp()
{
caberUnexploded.SetActive(false);
caberExploded.SetActive(true);
isCaberKablooey = true;
}
}
public class SosigRangeEditor : MonoBehaviour
{
public GameObject sosigParent;
public float modifierNumber = 1f;
public bool doesHavePerfectFOV = false;
private void Start()
{
sosigParent = ((Component)((Component)this).transform.root).gameObject;
Sosig component = ((Component)((Component)this).transform).GetComponent<Sosig>();
component.MaxSightRange *= modifierNumber;
if (doesHavePerfectFOV)
{
component.MaxFOV = 360f;
}
else
{
component.MaxFOV *= modifierNumber;
}
}
}
public class CuttableMesh
{
private MeshRenderer inputMeshRenderer;
private bool hasUvs;
private bool hasUv1s;
private bool hasColours;
private List<CuttableSubMesh> subMeshes;
public CuttableMesh(Mesh inputMesh)
{
Init(inputMesh, ((Object)inputMesh).name);
}
public CuttableMesh(MeshRenderer input)
{
inputMeshRenderer = input;
MeshFilter component = ((Component)input).GetComponent<MeshFilter>();
Mesh sharedMesh = component.sharedMesh;
Init(sharedMesh, ((Object)input).name);
}
public CuttableMesh(CuttableMesh inputMesh, List<CuttableSubMesh> newSubMeshes)
{
inputMeshRenderer = inputMesh.inputMeshRenderer;
hasUvs = inputMesh.hasUvs;
hasUv1s = inputMesh.hasUv1s;
hasColours = inputMesh.hasColours;
subMeshes = new List<CuttableSubMesh>();
subMeshes.AddRange(newSubMeshes);
}
private void Init(Mesh inputMesh, string debugName)
{
subMeshes = new List<CuttableSubMesh>();
if (inputMesh.isReadable)
{
Vector3[] vertices = inputMesh.vertices;
Vector3[] normals = inputMesh.normals;
Vector2[] uv = inputMesh.uv;
Vector2[] uv2 = inputMesh.uv2;
Color32[] colors = inputMesh.colors32;
hasUvs = uv != null && uv.Length > 0;
hasUv1s = uv2 != null && uv2.Length > 0;
hasColours = colors != null && colors.Length > 0;
for (int i = 0; i < inputMesh.subMeshCount; i++)
{
int[] indices = inputMesh.GetIndices(i);
CuttableSubMesh item = new CuttableSubMesh(indices, vertices, normals, colors, uv, uv2);
subMeshes.Add(item);
}
}
else
{
Debug.LogError((object)("CuttableMesh's input mesh is not readable: " + debugName), (Object)(object)inputMesh);
}
}
public void Add(CuttableMesh other)
{
if (subMeshes.Count != other.subMeshes.Count)
{
throw new Exception("Mismatched submesh count");
}
for (int i = 0; i < subMeshes.Count; i++)
{
subMeshes[i].Add(other.subMeshes[i]);
}
}
public int NumSubMeshes()
{
return subMeshes.Count;
}
public bool HasUvs()
{
return hasUvs;
}
public bool HasColours()
{
return hasColours;
}
public List<CuttableSubMesh> GetSubMeshes()
{
return subMeshes;
}
public CuttableSubMesh GetSubMesh(int index)
{
return subMeshes[index];
}
public Transform GetTransform()
{
if ((Object)(object)inputMeshRenderer != (Object)null)
{
return ((Component)inputMeshRenderer).transform;
}
return null;
}
public MeshRenderer ConvertToRenderer(string newObjectName)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//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_0085: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
Mesh val = CreateMesh();
if (val.vertexCount == 0)
{
return null;
}
GameObject val2 = new GameObject(newObjectName);
val2.transform.SetParent(((Component)inputMeshRenderer).transform);
val2.transform.localPosition = Vector3.zero;
val2.transform.localRotation = Quaternion.identity;
val2.transform.localScale = Vector3.one;
MeshFilter val3 = val2.AddComponent<MeshFilter>();
val3.mesh = val;
MeshRenderer val4 = val2.AddComponent<MeshRenderer>();
((Renderer)val4).shadowCastingMode = ((Renderer)inputMeshRenderer).shadowCastingMode;
((Renderer)val4).reflectionProbeUsage = ((Renderer)inputMeshRenderer).reflectionProbeUsage;
((Renderer)val4).lightProbeUsage = ((Renderer)inputMeshRenderer).lightProbeUsage;
((Renderer)val4).sharedMaterials = ((Renderer)inputMeshRenderer).sharedMaterials;
return val4;
}
public Mesh CreateMesh()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
Mesh val = new Mesh();
int num = 0;
for (int i = 0; i < subMeshes.Count; i++)
{
num += subMeshes[i].NumIndices();
}
List<Vector3> list = new List<Vector3>();
List<Vector3> list2 = new List<Vector3>();
List<Color32> list3 = ((!hasColours) ? null : new List<Color32>());
List<Vector2> list4 = ((!hasUvs) ? null : new List<Vector2>());
List<Vector2> list5 = ((!hasUv1s) ? null : new List<Vector2>());
List<int> list6 = new List<int>();
foreach (CuttableSubMesh subMesh in subMeshes)
{
list6.Add(list.Count);
subMesh.AddTo(list, list2, list3, list4, list5);
}
val.vertices = list.ToArray();
val.normals = list2.ToArray();
val.colors32 = ((!hasColours) ? null : list3.ToArray());
val.uv = ((!hasUvs) ? null : list4.ToArray());
val.uv2 = ((!hasUv1s) ? null : list5.ToArray());
val.subMeshCount = subMeshes.Count;
for (int j = 0; j < subMeshes.Count; j++)
{
CuttableSubMesh cuttableSubMesh = subMeshes[j];
int num2 = list6[j];
int[] array = cuttableSubMesh.GenIndices();
for (int k = 0; k < array.Length; k++)
{
array[k] += num2;
}
val.SetTriangles(array, j, true);
}
return val;
}
}
public class CuttableSubMesh
{
private List<Vector3> vertices;
private List<Vector3> normals;
private List<Color32> colours;
private List<Vector2> uvs;
private List<Vector2> uv1s;
public CuttableSubMesh(bool hasNormals, bool hasColours, bool hasUvs, bool hasUv1)
{
vertices = new List<Vector3>();
if (hasNormals)
{
normals = new List<Vector3>();
}
if (hasColours)
{
colours = new List<Color32>();
}
if (hasUvs)
{
uvs = new List<Vector2>();
}
if (hasUv1)
{
uv1s = new List<Vector2>();
}
}
public CuttableSubMesh(int[] indices, Vector3[] inputVertices, Vector3[] inputNormals, Color32[] inputColours, Vector2[] inputUvs, Vector2[] inputUv1)
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
vertices = new List<Vector3>();
if (inputNormals != null && inputNormals.Length > 0)
{
normals = new List<Vector3>();
}
if (inputColours != null && inputColours.Length > 0)
{
colours = new List<Color32>();
}
if (inputUvs != null && inputUvs.Length > 0)
{
uvs = new List<Vector2>();
}
if (inputUv1 != null && inputUv1.Length > 0)
{
uv1s = new List<Vector2>();
}
foreach (int num in indices)
{
vertices.Add(inputVertices[num]);
if (normals != null)
{
normals.Add(inputNormals[num]);
}
if (colours != null)
{
colours.Add(inputColours[num]);
}
if (uvs != null)
{
uvs.Add(inputUvs[num]);
}
if (uv1s != null)
{
uv1s.Add(inputUv1[num]);
}
}
}
public void Add(CuttableSubMesh other)
{
for (int i = 0; i < other.vertices.Count; i++)
{
CopyVertex(i, other);
}
}
public int NumVertices()
{
return vertices.Count;
}
public Vector3 GetVertex(int index)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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)
return vertices[index];
}
public bool HasNormals()
{
return normals != null;
}
public bool HasColours()
{
return colours != null;
}
public bool HasUvs()
{
return uvs != null;
}
public bool HasUv1()
{
return uv1s != null;
}
public void CopyVertex(int srcIndex, CuttableSubMesh srcMesh)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0096: Unknown result type (might be due to invalid IL or missing references)
vertices.Add(srcMesh.vertices[srcIndex]);
if (normals != null)
{
normals.Add(srcMesh.normals[srcIndex]);
}
if (colours != null)
{
colours.Add(srcMesh.colours[srcIndex]);
}
if (uvs != null)
{
uvs.Add(srcMesh.uvs[srcIndex]);
}
if (uv1s != null)
{
uv1s.Add(srcMesh.uv1s[srcIndex]);
}
}
public void AddInterpolatedVertex(int i0, int i1, float weight, CuttableSubMesh srcMesh)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
Vector3 vertex = srcMesh.GetVertex(i0);
Vector3 vertex2 = srcMesh.GetVertex(i1);
vertices.Add(Vector3.Lerp(vertex, vertex2, weight));
if (normals != null)
{
List<Vector3> list = normals;
Vector3 val = Vector3.Lerp(srcMesh.normals[i0], srcMesh.normals[i1], weight);
list.Add(((Vector3)(ref val)).normalized);
}
if (colours != null)
{
colours.Add(Color32.Lerp(srcMesh.colours[i0], srcMesh.colours[i1], weight));
}
if (uvs != null)
{
uvs.Add(Vector2.Lerp(srcMesh.uvs[i0], srcMesh.uvs[i1], weight));
}
if (uv1s != null)
{
uv1s.Add(Vector2.Lerp(srcMesh.uv1s[i0], srcMesh.uv1s[i1], weight));
}
}
public void AddTo(List<Vector3> destVertices, List<Vector3> destNormals, List<Color32> destColours, List<Vector2> destUvs, List<Vector2> destUv1s)
{
destVertices.AddRange(vertices);
if (normals != null)
{
destNormals.AddRange(normals);
}
if (colours != null)
{
destColours.AddRange(colours);
}
if (uvs != null)
{
destUvs.AddRange(uvs);
}
if (uv1s != null)
{
destUv1s.AddRange(uv1s);
}
}
public int NumIndices()
{
return vertices.Count;
}
public int[] GenIndices()
{
int[] array = new int[vertices.Count];
for (int i = 0; i < array.Length; i++)
{
array[i] = i;
}
return array;
}
}
public enum VertexClassification
{
Front = 1,
Back = 2,
OnPlane = 4
}
public class MeshCutter
{
private CuttableMesh inputMesh;
private List<CuttableSubMesh> outputFrontSubMeshes;
private List<CuttableSubMesh> outputBackSubMeshes;
public void Cut(CuttableMesh input, Plane worldCutPlane)
{
//IL_0067: 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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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_008a: Unknown result type (might be due to invalid IL or missing references)
inputMesh = input;
outputFrontSubMeshes = new List<CuttableSubMesh>();
outputBackSubMeshes = new List<CuttableSubMesh>();
Transform transform = inputMesh.GetTransform();
Plane cutPlane = default(Plane);
if ((Object)(object)transform != (Object)null)
{
Vector3 val = transform.InverseTransformPoint(ClosestPointOnPlane(worldCutPlane, Vector3.zero));
Vector3 val2 = transform.InverseTransformDirection(((Plane)(ref worldCutPlane)).normal);
((Plane)(ref cutPlane))..ctor(val2, val);
}
else
{
cutPlane = worldCutPlane;
}
foreach (CuttableSubMesh subMesh in input.GetSubMeshes())
{
Cut(subMesh, cutPlane);
}
}
private static Vector3 ClosestPointOnPlane(Plane plane, Vector3 point)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
float distanceToPoint = ((Plane)(ref plane)).GetDistanceToPoint(point);
if (((Plane)(ref plane)).GetSide(point))
{
return point - ((Plane)(ref plane)).normal * distanceToPoint;
}
return point + ((Plane)(ref plane)).normal * distanceToPoint;
}
public CuttableMesh GetFrontOutput()
{
return new CuttableMesh(inputMesh, outputFrontSubMeshes);
}
public CuttableMesh GetBackOutput()
{
return new CuttableMesh(inputMesh, outputBackSubMeshes);
}
private void Cut(CuttableSubMesh inputSubMesh, Plane cutPlane)
{
//IL_004f: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: 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_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: 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_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: 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_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
bool hasNormals = inputSubMesh.HasNormals();
bool hasColours = inputSubMesh.HasColours();
bool hasUvs = inputSubMesh.HasUvs();
bool hasUv = inputSubMesh.HasUv1();
CuttableSubMesh cuttableSubMesh = new CuttableSubMesh(hasNormals, hasColours, hasUvs, hasUv);
CuttableSubMesh cuttableSubMesh2 = new CuttableSubMesh(hasNormals, hasColours, hasUvs, hasUv);
for (int i = 0; i < inputSubMesh.NumVertices(); i += 3)
{
int num = i;
int num2 = i + 1;
int num3 = i + 2;
Vector3 vertex = inputSubMesh.GetVertex(num);
Vector3 vertex2 = inputSubMesh.GetVertex(num2);
Vector3 vertex3 = inputSubMesh.GetVertex(num3);
VertexClassification vertexClassification = Classify(vertex, cutPlane);
VertexClassification vertexClassification2 = Classify(vertex2, cutPlane);
VertexClassification vertexClassification3 = Classify(vertex3, cutPlane);
int numFront = 0;
int numBehind = 0;
CountSides(vertexClassification, ref numFront, ref numBehind);
CountSides(vertexClassification2, ref numFront, ref numBehind);
CountSides(vertexClassification3, ref numFront, ref numBehind);
if (numFront > 0 && numBehind == 0)
{
KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh);
}
else if (numFront == 0 && numBehind > 0)
{
KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh2);
}
else if (numFront == 2 && numBehind == 1)
{
if (vertexClassification == VertexClassification.Back)
{
SplitA(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh);
}
else if (vertexClassification2 == VertexClassification.Back)
{
SplitA(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh);
}
else
{
SplitA(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh);
}
}
else if (numFront == 1 && numBehind == 2)
{
if (vertexClassification == VertexClassification.Front)
{
SplitA(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
else if (vertexClassification2 == VertexClassification.Front)
{
SplitA(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
else
{
SplitA(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
}
else if (numFront == 1 && numBehind == 1)
{
if (vertexClassification == VertexClassification.OnPlane)
{
if (vertexClassification3 == VertexClassification.Front)
{
SplitB(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
else
{
SplitBFlipped(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
continue;
}
switch (vertexClassification2)
{
case VertexClassification.OnPlane:
if (vertexClassification == VertexClassification.Front)
{
SplitB(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
else
{
SplitBFlipped(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
break;
case VertexClassification.Front:
SplitB(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
break;
default:
SplitBFlipped(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
break;
}
}
else if (numFront == 0 && numBehind == 0)
{
Vector3 val = vertex2 - vertex;
Vector3 val2 = vertex3 - vertex;
Vector3 val3 = Vector3.Cross(val, val2);
if (Vector3.Dot(val3, ((Plane)(ref cutPlane)).normal) > 0f)
{
KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh2);
}
else
{
KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh);
}
}
}
outputFrontSubMeshes.Add(cuttableSubMesh);
outputBackSubMeshes.Add(cuttableSubMesh2);
}
private VertexClassification Classify(Vector3 vertex, Plane cutPlane)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(vertex.x, vertex.y, vertex.z);
float distanceToPoint = ((Plane)(ref cutPlane)).GetDistanceToPoint(val);
double num = 9.999999747378752E-06;
if ((double)distanceToPoint > 0.0 - num && (double)distanceToPoint < num)
{
return VertexClassification.OnPlane;
}
if (distanceToPoint > 0f)
{
return VertexClassification.Front;
}
return VertexClassification.Back;
}
private void CountSides(VertexClassification c, ref int numFront, ref int numBehind)
{
switch (c)
{
case VertexClassification.Front:
numFront++;
break;
case VertexClassification.Back:
numBehind++;
break;
}
}
private void KeepTriangle(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, CuttableSubMesh destSubMesh)
{
destSubMesh.CopyVertex(i0, inputSubMesh);
destSubMesh.CopyVertex(i1, inputSubMesh);
destSubMesh.CopyVertex(i2, inputSubMesh);
}
private void SplitA(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, Plane cutPlane, CuttableSubMesh frontSubMesh, CuttableSubMesh backSubMesh)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
Vector3 vertex = inputSubMesh.GetVertex(i0);
Vector3 vertex2 = inputSubMesh.GetVertex(i1);
Vector3 vertex3 = inputSubMesh.GetVertex(i2);
CalcIntersection(vertex, vertex2, cutPlane, out var weight);
CalcIntersection(vertex3, vertex, cutPlane, out var weight2);
frontSubMesh.CopyVertex(i0, inputSubMesh);
frontSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
frontSubMesh.AddInterpolatedVertex(i2, i0, weight2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
backSubMesh.CopyVertex(i1, inputSubMesh);
backSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i2, i0, weight2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
}
private void SplitB(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, Plane cutPlane, CuttableSubMesh frontSubMesh, CuttableSubMesh backSubMesh)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
Vector3 vertex = inputSubMesh.GetVertex(i0);
Vector3 vertex2 = inputSubMesh.GetVertex(i2);
CalcIntersection(vertex2, vertex, cutPlane, out var weight);
frontSubMesh.CopyVertex(i0, inputSubMesh);
frontSubMesh.CopyVertex(i1, inputSubMesh);
frontSubMesh.AddInterpolatedVertex(i2, i0, weight, inputSubMesh);
backSubMesh.CopyVertex(i1, inputSubMesh);
backSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i2, i0, weight, inputSubMesh);
}
private void SplitBFlipped(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, Plane cutPlane, CuttableSubMesh frontSubMesh, CuttableSubMesh backSubMesh)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
Vector3 vertex = inputSubMesh.GetVertex(i0);
Vector3 vertex2 = inputSubMesh.GetVertex(i1);
CalcIntersection(vertex, vertex2, cutPlane, out var weight);
frontSubMesh.CopyVertex(i0, inputSubMesh);
frontSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
frontSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.CopyVertex(i1, inputSubMesh);
backSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
}
private Vector3 CalcIntersection(Vector3 v0, Vector3 v1, Plane plane, out float weight)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_003f: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = v1 - v0;
float magnitude = ((Vector3)(ref val)).magnitude;
Ray val2 = default(Ray);
((Ray)(ref val2))..ctor(v0, val / magnitude);
float num = default(float);
((Plane)(ref plane)).Raycast(val2, ref num);
Vector3 result = ((Ray)(ref val2)).origin + ((Ray)(ref val2)).direction * num;
weight = num / magnitude;
return result;
}
}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.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CustomTargets;
using FistVR;
using H3VRUtils.MonoScripts.VisualModifiers;
using HarmonyLib;
using JerryComponent;
using OpenScripts2;
using OtherLoader;
using Popcron;
using ToxicGasFramework;
using UnityEditor;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.PostProcessing;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using visSpace;
[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]
namespace JerryComponent
{
public class Scale16muzzle : MonoBehaviour
{
public Suppressor muzzledevice;
public GameObject muzzleinterface;
public bool scaled = false;
public bool magscaled = false;
public bool clipscaled = false;
public FVRFireArm firearm;
public Vector3 scaleoriginal;
public Vector3 magscaleoriginal;
public Vector3 clipscaleoriginal;
public FVRPhysicalObjectSize size;
private void Start()
{
}
private void Update()
{
//IL_009f: 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_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)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)firearm == (Object)null || (Object)(object)((FVRFireArmAttachment)muzzledevice).curMount == (Object)null || (Object)(object)((FVRFireArmAttachment)muzzledevice).curMount.Parent == (Object)null || (Object)(object)firearm.Magazine == (Object)null || (Object)(object)firearm.Clip == (Object)null)
{
}
if ((Object)(object)firearm != (Object)null && !scaled)
{
scaleoriginal = ((Component)firearm).gameObject.transform.localScale;
size = ((FVRPhysicalObject)firearm).Size;
scaled = true;
}
if ((Object)(object)firearm != (Object)null && !magscaled && (Object)(object)firearm.Magazine != (Object)null)
{
magscaleoriginal = ((Component)firearm.Magazine).gameObject.transform.localScale;
magscaled = true;
}
if ((Object)(object)firearm != (Object)null && !clipscaled && (Object)(object)firearm.Clip != (Object)null)
{
clipscaleoriginal = ((Component)firearm.Clip).gameObject.transform.localScale;
clipscaled = true;
}
if ((Object)(object)((FVRFireArmAttachment)muzzledevice).curMount != (Object)null && ((FVRFireArmAttachment)muzzledevice).curMount.AttachmentsList.Count > 0)
{
firearm = ((Component)((FVRFireArmAttachment)muzzledevice).curMount.Parent).GetComponent<FVRFireArm>();
if ((Object)(object)firearm.Magazine == (Object)null)
{
magscaled = false;
}
if ((Object)(object)firearm.Clip == (Object)null)
{
clipscaled = false;
}
if (1f - 5f * (muzzledevice.CatchRot / 360f) / 6f <= 0f)
{
((FVRPhysicalObject)firearm).Size = (FVRPhysicalObjectSize)0;
}
if (1f - 5f * (muzzledevice.CatchRot / 360f) / 6f > 0f)
{
((FVRPhysicalObject)firearm).Size = size;
}
((Component)firearm).gameObject.transform.localScale = scaleoriginal * (1f - 5f * (muzzledevice.CatchRot / 360f) / 6f);
}
if ((Object)(object)((FVRFireArmAttachment)muzzledevice).curMount != (Object)null && ((FVRFireArmAttachment)muzzledevice).curMount.AttachmentsList.Count < 1)
{
firearm = null;
scaled = false;
}
}
}
}
public class BottleSmash : MonoBehaviour
{
[ColorUsage(true, true, 0f, 8f, 0.125f, 3f)]
public Color color;
[SerializeField]
[HideInInspector]
private Color cachedColor;
[SerializeField]
[HideInInspector]
private List<ColorBase> registeredComponents;
public GameObject Cork;
public GameObject Liquid;
public GameObject Glass;
public GameObject Glass_Shattered;
public GameObject Label;
public float DespawnTime = 5f;
public ParticleSystem Effect;
public GameObject Splat;
public LayerMask SplatMask;
public float maxSplatDistance = 5f;
public float shatterAtSpeed = 2f;
public bool allowShattering = true;
public bool onlyAllowShatterOnCollision = true;
[SerializeField]
[HideInInspector]
private Vector3 previousPos;
[SerializeField]
[HideInInspector]
private Vector3 previousVelocity;
[SerializeField]
[HideInInspector]
private Vector3 randomRot;
[SerializeField]
[HideInInspector]
private float _lastHitSpeed = 0f;
private bool broken = false;
private float collidedRecently = -1f;
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
previousPos = ((Component)this).transform.position;
}
public void RandomizeColor()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
color = new Color((float)Random.Range(0, 1), (float)Random.Range(0, 1), (float)Random.Range(0, 1), 1f);
}
private void OnCollisionEnter(Collision collision)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
Vector3 impulse = collision.impulse;
_lastHitSpeed = ((Vector3)(ref impulse)).magnitude;
if (((Component)collision.transform).tag != "Liquid")
{
collidedRecently = 0.2f;
}
}
public void AttemptCollision(Collision col)
{
OnCollisionEnter(col);
}
public void RegisterColorBase(ColorBase cb)
{
registeredComponents.Add(cb);
}
public void ChangedColor()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (!(cachedColor != color))
{
return;
}
cachedColor = color;
foreach (ColorBase registeredComponent in registeredComponents)
{
registeredComponent.Unify();
}
}
public Vector3 GetRandomRotation()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
return randomRot;
}
public void RandomRotation()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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)
Vector3 val = Random.insideUnitSphere + Vector3.forward;
randomRot = ((Vector3)(ref val)).normalized;
}
public void Smash()
{
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
broken = true;
if ((Object)(object)Cork != (Object)null)
{
Cork.transform.parent = null;
Cork.GetComponent<Collider>().enabled = true;
Cork.GetComponent<Rigidbody>().isKinematic = false;
Object.Destroy((Object)(object)Cork.gameObject, DespawnTime);
}
if ((Object)(object)Liquid != (Object)null)
{
float num = 0f;
Object.Destroy((Object)(object)Liquid.gameObject, num);
}
if ((Object)(object)Effect != (Object)null)
{
Effect.Play();
GameObject gameObject = ((Component)Effect).gameObject;
MainModule main = Effect.main;
MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
Object.Destroy((Object)(object)gameObject, ((MinMaxCurve)(ref startLifetime)).constantMax);
}
if ((Object)(object)Label != (Object)null)
{
Object.Destroy((Object)(object)Label.gameObject);
}
if ((Object)(object)Glass != (Object)null)
{
Object.Destroy((Object)(object)Glass.gameObject);
}
if ((Object)(object)Glass_Shattered != (Object)null)
{
Glass_Shattered.SetActive(true);
Glass_Shattered.transform.parent = null;
Object.Destroy((Object)(object)Glass_Shattered, DespawnTime);
}
RaycastHit val = default(RaycastHit);
if ((Object)(object)Splat != (Object)null && Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, maxSplatDistance, LayerMask.op_Implicit(SplatMask)))
{
GameObject val2 = Object.Instantiate<GameObject>(Splat);
val2.transform.position = ((RaycastHit)(ref val)).point;
}
Object.Destroy((Object)(object)((Component)((Component)this).transform).gameObject, DespawnTime);
}
private void FixedUpdate()
{
//IL_001f: 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_002a: 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_0039: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: 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_0076: Unknown result type (might be due to invalid IL or missing references)
ChangedColor();
collidedRecently -= Time.deltaTime;
Vector3 val = (((Component)this).transform.position - previousPos) / Time.fixedDeltaTime;
if (((onlyAllowShatterOnCollision && collidedRecently >= 0f) | !onlyAllowShatterOnCollision) && allowShattering && (Vector3.Distance(val, previousVelocity) > shatterAtSpeed || _lastHitSpeed > shatterAtSpeed) && !broken)
{
Smash();
}
_lastHitSpeed = 0f;
previousVelocity = val;
previousPos = ((Component)this).transform.position;
}
}
public class ColorBase : MonoBehaviour
{
protected virtual void RegisterWithController()
{
}
public virtual void Unify()
{
}
}
public class LiquidColor : ColorBase
{
public BottleSmash bottleSmash;
private LiquidVolumeAnimator lva;
public bool UpdateSurfaceColor = true;
public bool UpdateColor = true;
public bool UpdateSurfaceEmission = true;
public bool UpdateEmission = true;
private void Start()
{
lva = ((Component)this).GetComponent<LiquidVolumeAnimator>();
if ((Object)(object)bottleSmash == (Object)null)
{
bottleSmash = ((Component)this).GetComponentInParent<BottleSmash>();
}
RegisterWithController();
}
protected override void RegisterWithController()
{
bottleSmash.RegisterColorBase(this);
}
public override void Unify()
{
//IL_0025: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
if (UpdateColor)
{
lva.mats[0].SetColor("_Color", bottleSmash.color);
}
if (UpdateEmission)
{
lva.mats[0].SetColor("_EmissionColor", bottleSmash.color);
}
if (UpdateSurfaceColor)
{
lva.mats[0].SetColor("_SColor", bottleSmash.color);
}
if (UpdateSurfaceEmission)
{
lva.mats[0].SetColor("_SEmissionColor", bottleSmash.color);
}
}
}
public class PS_Color : ColorBase
{
public BottleSmash bottleSmash;
private ParticleSystem ps;
private void Start()
{
ps = ((Component)this).GetComponent<ParticleSystem>();
if ((Object)(object)bottleSmash == (Object)null)
{
bottleSmash = ((Component)this).GetComponentInParent<BottleSmash>();
}
RegisterWithController();
}
protected override void RegisterWithController()
{
bottleSmash.RegisterColorBase(this);
}
public override void Unify()
{
UpdateValues();
}
public void UpdateValues()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
MainModule main = ps.main;
((MainModule)(ref main)).startColor = new MinMaxGradient(bottleSmash.color);
}
}
public class ParticleColor : ColorBase
{
public enum ColorID
{
_TintColor,
_Color
}
public BottleSmash bottleSmash;
private ParticleSystemRenderer ps;
public ColorID colorType;
private void Start()
{
ps = ((Component)this).GetComponent<ParticleSystemRenderer>();
if ((Object)(object)bottleSmash == (Object)null)
{
bottleSmash = ((Component)this).GetComponentInParent<BottleSmash>();
}
RegisterWithController();
}
protected override void RegisterWithController()
{
bottleSmash.RegisterColorBase(this);
}
public override void Unify()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
switch (colorType)
{
case ColorID._TintColor:
((Renderer)ps).material.SetColor("_TintColor", bottleSmash.color);
break;
case ColorID._Color:
((Renderer)ps).material.SetColor("_Color", bottleSmash.color);
break;
}
}
}
public class ResetColors : MonoBehaviour
{
public LiquidVolumeAnimator LVA;
public float timeout = 5f;
private float tReset;
public BottleSmash BS;
public Color Color1;
public Color Color2;
private void Start()
{
tReset = timeout;
}
private void Update()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_0062: 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_004b: Unknown result type (might be due to invalid IL or missing references)
timeout -= Time.deltaTime;
if (timeout <= 0f)
{
if (BS.color == Color1)
{
BS.color = Color2;
}
else
{
BS.color = Color1;
}
LVA.level = 1f;
timeout = tReset;
}
}
}
public class DemoRotation : MonoBehaviour
{
private BottleSmash BS;
public float rotSpeed = 30f;
private void Start()
{
BS = ((Component)this).GetComponent<BottleSmash>();
}
private void Update()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
Vector3 randomRotation = BS.GetRandomRotation();
Vector3 normalized = ((Vector3)(ref randomRotation)).normalized;
if (normalized != Vector3.zero)
{
Vector3 randomRotation2 = BS.GetRandomRotation();
Vector3 normalized2 = ((Vector3)(ref randomRotation2)).normalized;
Vector3 val = ((Component)BS).transform.up + Vector3.up;
if (Vector3.Dot(normalized2, ((Vector3)(ref val)).normalized) < 0.98f)
{
Transform transform = ((Component)BS).transform;
Quaternion rotation = ((Component)BS).transform.rotation;
Vector3 randomRotation3 = BS.GetRandomRotation();
Vector3 val2 = ((Component)BS).transform.up + Vector3.up;
transform.rotation = Quaternion.RotateTowards(rotation, Quaternion.LookRotation(randomRotation3, ((Vector3)(ref val2)).normalized), rotSpeed * Time.deltaTime);
}
}
}
}
public class ForceTest : MonoBehaviour
{
public bool AddForce = false;
public Vector3 force;
private LiquidVolumeAnimator lva;
private void Start()
{
lva = ((Component)this).GetComponent<LiquidVolumeAnimator>();
}
private void Update()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (AddForce)
{
lva.AddForce(force);
AddForce = false;
}
}
}
public class LiquidAbsorption : MonoBehaviour
{
public Color currentColor;
public BottleSmash smashScript;
public float particleValue = 0.02f;
public LiquidVolumeAnimator LVA;
private void Start()
{
if ((Object)(object)LVA == (Object)null)
{
LVA = ((Component)this).GetComponent<LiquidVolumeAnimator>();
}
}
private void OnParticleCollision(GameObject other)
{
//IL_0093: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: 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_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)other.transform.parent == (Object)(object)((Component)this).transform.parent)
{
return;
}
bool flag = false;
if ((Object)(object)smashScript.Cork == (Object)null)
{
flag = true;
}
else if (!smashScript.Cork.activeSelf)
{
flag = true;
}
else if (!smashScript.Cork.GetComponent<Rigidbody>().isKinematic)
{
flag = true;
}
if (!flag)
{
return;
}
currentColor = smashScript.color;
if (LVA.level < 1f - particleValue)
{
Color color = other.GetComponentInParent<BottleSmash>().color;
if (LVA.level <= 1.4E-44f)
{
currentColor = color;
}
else
{
currentColor = Color.Lerp(currentColor, color, particleValue / LVA.level);
}
LVA.level += particleValue;
smashScript.color = currentColor;
}
}
private void Update()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
currentColor = smashScript.color;
}
}
public class LiquidAbsorptionV2 : MonoBehaviour
{
public Color currentColor;
public BottleSmash smashScript;
public MeshLiquidEmission LiquidEmission;
public LiquidVolumeAnimator LVA;
private float particleValue = 1f;
private void Start()
{
if ((Object)(object)LVA == (Object)null)
{
LVA = ((Component)this).GetComponent<LiquidVolumeAnimator>();
}
}
private void OnParticleCollision(GameObject other)
{
//IL_00ac: 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)
//IL_00d4: 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_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)other.transform.parent == (Object)(object)((Component)this).transform.parent)
{
return;
}
bool flag = false;
if ((Object)(object)smashScript.Cork == (Object)null)
{
flag = true;
}
else if (!smashScript.Cork.activeSelf)
{
flag = true;
}
else if (!smashScript.Cork.GetComponent<Rigidbody>().isKinematic)
{
flag = true;
}
float num = particleValue * (1f / LiquidEmission.volumeOfParticles);
if (!flag)
{
return;
}
currentColor = smashScript.color;
if (LVA.level < 1f - num)
{
Color color = other.GetComponentInParent<BottleSmash>().color;
if (LVA.level <= 1.4E-44f)
{
currentColor = color;
}
else
{
currentColor = Color.Lerp(currentColor, color, num / LVA.level);
}
LVA.level += num;
smashScript.color = currentColor;
}
}
private void Update()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
currentColor = smashScript.color;
}
}
public class LiquidPool : MonoBehaviour
{
public float minSize = 0.5f;
public float maxSize = 1f;
public float timeToComplete = 0.5f;
private float randomSize;
private float currentTime = 0f;
private bool fadingOut = false;
private MeshRenderer mr;
private Material mat;
private void Start()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.localScale = Vector3.zero;
randomSize = Random.Range(minSize, maxSize);
mr = ((Component)this).GetComponent<MeshRenderer>();
mat = ((Renderer)mr).material;
mat = Object.Instantiate<Material>(mat);
((Renderer)mr).material = mat;
}
private void Update()
{
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: 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)
currentTime += Time.deltaTime * (float)((!fadingOut) ? 1 : (-1));
if (currentTime >= timeToComplete)
{
fadingOut = true;
}
if (fadingOut)
{
mat.color = new Color(mat.color.r, mat.color.g, mat.color.b, Mathf.Lerp(0f, 1f, currentTime / timeToComplete));
}
else
{
((Component)this).transform.localScale = Vector3.one * Mathf.Lerp(0f, randomSize, currentTime / timeToComplete);
}
if (fadingOut && currentTime <= 0f)
{
Object.Destroy((Object)(object)((Component)((Component)this).transform).gameObject);
}
}
}
[Serializable]
public class LiquidVolumeAnimator : MonoBehaviour
{
[HideInInspector]
[SerializeField]
public Material[] mats;
[Range(0f, 1f)]
[SerializeField]
public float level = 0.5f;
private float finalLevel;
public Vector2 minMaxBounds;
[HideInInspector]
[SerializeField]
private MeshFilter mf;
[HideInInspector]
[SerializeField]
private MeshRenderer mr;
[HideInInspector]
[SerializeField]
private Mesh m;
public bool DebugAnchor = false;
public float debugSize = 1f;
public float _anchorLength = 0.5f;
[Range(0f, 1f)]
public float dampening;
[HideInInspector]
[SerializeField]
private Vector3 anchor;
[HideInInspector]
[SerializeField]
private Vector3 anchorVelocity;
[HideInInspector]
[SerializeField]
private Vector3 transformedPoint;
[HideInInspector]
[SerializeField]
private Vector3 prevTransformedPoint;
public bool calculateTextureProjection = true;
public float TextureSize = 1f;
public float TextureSizeScalar = 1f;
public AnimationCurve texCurveSize = AnimationCurve.Linear(0f, 1f, 1f, 1f);
private Quaternion previous;
private float totalRotation = 0f;
[HideInInspector]
[SerializeField]
private Vector3 TopLeft;
[HideInInspector]
[SerializeField]
private Vector3 TopRight;
[HideInInspector]
[SerializeField]
private Vector3 BottomLeft;
[HideInInspector]
[SerializeField]
private Vector3 BottomRight;
public Transform ExposedLiquidT;
public Vector3 GravityDirection = Vector3.down;
public bool normalizeGravityDirection = true;
[HideInInspector]
[SerializeField]
private Vector3[] verts;
private int shader_Key_localHeight;
private int shader_Key_anchor;
private int shader_Key_point;
private int shader_Key_level;
private float prvLevel = -1f;
private Quaternion prevQ = Quaternion.identity;
[HideInInspector]
[SerializeField]
private Vector3 cPos = Vector3.zero;
public Vector3 finalAnchor;
public Vector3 finalPoint;
[HideInInspector]
[SerializeField]
private string[] shaderNames;
private void OnDrawGizmosSelected()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: 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_009c: 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)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: 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)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: 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_0198: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
float num = _anchorLength * Mathf.Max(new float[3]
{
((Component)this).transform.lossyScale.x,
((Component)this).transform.lossyScale.y,
((Component)this).transform.lossyScale.z
});
if (DebugAnchor)
{
cPos = ((Component)this).transform.position;
Vector3 val = cPos - ((Component)this).transform.TransformDirection(Vector3.up) * num;
if (anchor == Vector3.zero)
{
anchor = val;
}
CalculateSquare(anchor);
Vector3 lossyScale = ((Component)this).transform.lossyScale;
Gizmos.DrawSphere(val, 0.25f * ((Vector3)(ref lossyScale)).magnitude * 0.1f * debugSize);
Gizmos.DrawLine(cPos, val);
Gizmos.color = Color.blue;
Vector3 val2 = anchor;
Vector3 lossyScale2 = ((Component)this).transform.lossyScale;
Gizmos.DrawSphere(val2, 0.25f * ((Vector3)(ref lossyScale2)).magnitude * 0.1f * debugSize);
Gizmos.color = Color.red;
Vector3 val3 = cPos;
Vector3 val4 = val - cPos;
Vector3 val5 = val3 - ((Vector3)(ref val4)).normalized * finalLevel;
Vector3 lossyScale3 = ((Component)this).transform.lossyScale;
Gizmos.DrawSphere(val5, 0.1f * ((Vector3)(ref lossyScale3)).magnitude * 0.01f * debugSize);
Gizmos.color = Color.yellow;
Vector3 topLeft = TopLeft;
Vector3 lossyScale4 = ((Component)this).transform.lossyScale;
Gizmos.DrawSphere(topLeft, 0.25f * ((Vector3)(ref lossyScale4)).magnitude * 0.01f * debugSize);
Vector3 topRight = TopRight;
Vector3 lossyScale5 = ((Component)this).transform.lossyScale;
Gizmos.DrawSphere(topRight, 0.25f * ((Vector3)(ref lossyScale5)).magnitude * 0.01f * debugSize);
Vector3 bottomLeft = BottomLeft;
Vector3 lossyScale6 = ((Component)this).transform.lossyScale;
Gizmos.DrawSphere(bottomLeft, 0.25f * ((Vector3)(ref lossyScale6)).magnitude * 0.01f * debugSize);
Vector3 bottomRight = BottomRight;
Vector3 lossyScale7 = ((Component)this).transform.lossyScale;
Gizmos.DrawSphere(bottomRight, 0.25f * ((Vector3)(ref lossyScale7)).magnitude * 0.01f * debugSize);
Gizmos.color = Color.white;
CalculateSquare(anchor);
}
}
private void CalculateSquare(Vector3 anch)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_0037: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0062: 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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_0091: 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)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: 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_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: 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_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
if (calculateTextureProjection)
{
Vector3 val = cPos;
Vector3 val2 = anch - cPos;
Vector3 val3 = val - ((Vector3)(ref val2)).normalized * finalLevel;
Vector3 val4 = cPos;
Vector3 val5 = anch - cPos;
Vector3 val6 = val4 - ((Vector3)(ref val5)).normalized * finalLevel - anch;
Vector3 normalized = ((Vector3)(ref val6)).normalized;
Vector3 val7 = Quaternion.Euler(0f, totalRotation, 0f) * Vector3.right;
Vector3 val8 = Vector3.Cross(val7, ((Vector3)(ref normalized)).normalized);
Vector3 normalized2 = ((Vector3)(ref val8)).normalized;
Vector3 val9 = Vector3.Cross(normalized2, normalized);
Vector3 normalized3 = ((Vector3)(ref val9)).normalized;
Vector3 val10 = Vector3.Cross(normalized3, normalized);
normalized2 = ((Vector3)(ref val10)).normalized;
float num = TextureSize * texCurveSize.Evaluate(Mathf.Clamp01(level));
Vector3 lossyScale = ((Component)this).transform.lossyScale;
float num2 = num * ((Vector3)(ref lossyScale)).magnitude * 0.001f;
TopLeft = normalized3 * num2 + normalized2 * num2 + val3;
TopRight = normalized3 * num2 * -1f + normalized2 * num2 + val3;
BottomLeft = normalized3 * num2 + normalized2 * num2 * -1f + val3;
BottomRight = normalized3 * num2 * -1f - normalized2 * num2 + val3;
}
}
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
cPos = ((Component)this).transform.position;
shader_Key_localHeight = Shader.PropertyToID("_localHeight");
shader_Key_anchor = Shader.PropertyToID("_anchor");
shader_Key_point = Shader.PropertyToID("_point");
shader_Key_level = Shader.PropertyToID("_level");
prevTransformedPoint = (transformedPoint = ((Component)this).transform.TransformDirection((!normalizeGravityDirection) ? GravityDirection : ((Vector3)(ref GravityDirection)).normalized));
anchor -= ((!normalizeGravityDirection) ? GravityDirection : ((Vector3)(ref GravityDirection)).normalized) * -1f * Time.deltaTime * (1f - dampening);
((Vector3)(ref anchor)).Normalize();
mr = ((Component)this).GetComponent<MeshRenderer>();
mats = ((Renderer)mr).materials;
shaderNames = new string[mats.Length];
for (int i = 0; i < mats.Length; i++)
{
mats[i] = Object.Instantiate<Material>(mats[i]);
shaderNames[i] = ((Object)mats[i].shader).name;
}
mf = ((Component)this).GetComponent<MeshFilter>();
m = mf.sharedMesh;
verts = (Vector3[])(object)new Vector3[m.vertices.Length];
verts = m.vertices;
minMaxBounds.x = (minMaxBounds.y = verts[0].y);
for (int j = 0; j < verts.Length; j++)
{
Vector3 val = ((Component)this).transform.TransformDirection(verts[j]);
if (val.y > minMaxBounds.y)
{
minMaxBounds.y = val.y;
}
if (val.y < minMaxBounds.x)
{
minMaxBounds.x = val.y;
}
}
ref Vector2 reference = ref minMaxBounds;
reference.x -= cPos.y;
ref Vector2 reference2 = ref minMaxBounds;
reference2.y -= cPos.y;
for (int k = 0; k < mats.Length; k++)
{
mats[k].SetFloat(shader_Key_localHeight, Mathf.Lerp(minMaxBounds.x, minMaxBounds.y, level));
}
((Renderer)mr).materials = mats;
}
public void AddForce(Vector3 force)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
anchorVelocity += force;
}
private void FixedUpdate()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00b2: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: 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_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: 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_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: 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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: 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_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: 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_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_037e: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_0389: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
//IL_035a: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Unknown result type (might be due to invalid IL or missing references)
//IL_0366: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
//IL_040c: Unknown result type (might be due to invalid IL or missing references)
//IL_0411: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_045b: Unknown result type (might be due to invalid IL or missing references)
//IL_0460: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Unknown result type (might be due to invalid IL or missing references)
//IL_046a: Unknown result type (might be due to invalid IL or missing references)
//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
//IL_04de: Unknown result type (might be due to invalid IL or missing references)
//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0501: Unknown result type (might be due to invalid IL or missing references)
//IL_0506: Unknown result type (might be due to invalid IL or missing references)
//IL_050b: Unknown result type (might be due to invalid IL or missing references)
//IL_050d: Unknown result type (might be due to invalid IL or missing references)
//IL_050f: Unknown result type (might be due to invalid IL or missing references)
//IL_0516: Unknown result type (might be due to invalid IL or missing references)
//IL_0518: Unknown result type (might be due to invalid IL or missing references)
//IL_051a: Unknown result type (might be due to invalid IL or missing references)
//IL_051f: Unknown result type (might be due to invalid IL or missing references)
//IL_0688: Unknown result type (might be due to invalid IL or missing references)
//IL_068d: Unknown result type (might be due to invalid IL or missing references)
//IL_0699: Unknown result type (might be due to invalid IL or missing references)
//IL_069e: Unknown result type (might be due to invalid IL or missing references)
//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
//IL_06af: Unknown result type (might be due to invalid IL or missing references)
//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
//IL_06da: Unknown result type (might be due to invalid IL or missing references)
//IL_06df: Unknown result type (might be due to invalid IL or missing references)
//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0701: Unknown result type (might be due to invalid IL or missing references)
//IL_070a: Unknown result type (might be due to invalid IL or missing references)
//IL_0710: Unknown result type (might be due to invalid IL or missing references)
//IL_0716: Unknown result type (might be due to invalid IL or missing references)
//IL_071b: Unknown result type (might be due to invalid IL or missing references)
//IL_0720: Unknown result type (might be due to invalid IL or missing references)
//IL_0724: Unknown result type (might be due to invalid IL or missing references)
//IL_072f: Unknown result type (might be due to invalid IL or missing references)
//IL_0734: Unknown result type (might be due to invalid IL or missing references)
//IL_0739: Unknown result type (might be due to invalid IL or missing references)
//IL_073e: Unknown result type (might be due to invalid IL or missing references)
//IL_0743: Unknown result type (might be due to invalid IL or missing references)
//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
//IL_05de: Unknown result type (might be due to invalid IL or missing references)
//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0602: Unknown result type (might be due to invalid IL or missing references)
//IL_061d: Unknown result type (might be due to invalid IL or missing references)
//IL_0628: Unknown result type (might be due to invalid IL or missing references)
//IL_062d: Unknown result type (might be due to invalid IL or missing references)
//IL_0636: Unknown result type (might be due to invalid IL or missing references)
//IL_0640: Unknown result type (might be due to invalid IL or missing references)
//IL_064b: Unknown result type (might be due to invalid IL or missing references)
//IL_0656: Unknown result type (might be due to invalid IL or missing references)
//IL_0667: Unknown result type (might be due to invalid IL or missing references)
//IL_066d: Unknown result type (might be due to invalid IL or missing references)
//IL_0672: Unknown result type (might be due to invalid IL or missing references)
//IL_0677: Unknown result type (might be due to invalid IL or missing references)
//IL_067b: Unknown result type (might be due to invalid IL or missing references)
//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0802: Unknown result type (might be due to invalid IL or missing references)
//IL_0779: Unknown result type (might be due to invalid IL or missing references)
//IL_078e: Unknown result type (might be due to invalid IL or missing references)
//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
//IL_07cd: Unknown result type (might be due to invalid IL or missing references)
cPos = ((Component)this).transform.position;
float num = _anchorLength * Mathf.Max(new float[3]
{
((Component)this).transform.lossyScale.x,
((Component)this).transform.lossyScale.y,
((Component)this).transform.lossyScale.z
});
transformedPoint = ((Component)this).transform.TransformDirection((!normalizeGravityDirection) ? GravityDirection : ((Vector3)(ref GravityDirection)).normalized);
anchor += anchorVelocity * (1f - dampening);
Vector3 val = anchor;
anchor -= ((!normalizeGravityDirection) ? GravityDirection : ((Vector3)(ref GravityDirection)).normalized) * -1f * Time.deltaTime * (1f - dampening);
float num2 = Vector3.Distance(anchor, cPos);
if (num2 > num)
{
Vector3 val2 = cPos;
Vector3 val3 = anchor - cPos;
anchor = val2 + ((Vector3)(ref val3)).normalized * num;
}
Vector3 val4 = anchor - val + (transformedPoint - prevTransformedPoint) * -1f * (1f / num) * Time.deltaTime;
if (val4 == Vector3.zero && prvLevel == level && prevQ == ((Component)this).transform.rotation)
{
return;
}
anchorVelocity += val4;
Matrix4x4 localToWorldMatrix = ((Component)this).transform.localToWorldMatrix;
minMaxBounds.x = (minMaxBounds.y = ((Component)this).transform.TransformPoint(verts[0]).y);
for (int i = 0; i < verts.Length; i++)
{
Vector3 val5 = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint(verts[i]);
if (val5.y > minMaxBounds.y)
{
minMaxBounds.y = val5.y;
}
if (val5.y < minMaxBounds.x)
{
minMaxBounds.x = val5.y;
}
}
ref Vector2 reference = ref minMaxBounds;
reference.y -= cPos.y;
ref Vector2 reference2 = ref minMaxBounds;
reference2.x -= cPos.y;
finalLevel = Mathf.Lerp(minMaxBounds.x, minMaxBounds.y, level);
if (level <= 1.4E-44f)
{
anchor = Vector3.down * num + cPos;
}
Vector3 val6 = cPos;
Vector3 val7 = anchor - cPos;
finalPoint = val6 - ((Vector3)(ref val7)).normalized * finalLevel;
for (int j = 0; j < mats.Length; j++)
{
mats[j].SetFloat(shader_Key_localHeight, Mathf.Lerp(minMaxBounds.x - 1.4E-44f, minMaxBounds.y + 1.4E-44f, level));
mats[j].SetVector(shader_Key_anchor, Vector4.op_Implicit(((Component)this).transform.InverseTransformPoint(anchor)));
Material obj = mats[j];
int num3 = shader_Key_point;
Transform transform = ((Component)this).transform;
Vector3 val8 = cPos;
Vector3 val9 = anchor - cPos;
obj.SetVector(num3, Vector4.op_Implicit(transform.InverseTransformPoint(val8 - ((Vector3)(ref val9)).normalized * finalLevel)));
mats[j].SetFloat(shader_Key_level, level - float.Epsilon);
}
finalAnchor = anchor;
CalculateSquare(anchor);
Quaternion val10 = Quaternion.LookRotation(previous * Vector3.right, Vector3.up);
Vector3 val11 = val10 * Vector3.right;
Quaternion val12 = Quaternion.LookRotation(((Component)this).transform.rotation * Vector3.right, Vector3.up);
float num4 = Quaternion.Angle(val10, val12) * (float)((!(Vector3.Dot(val11, val12 * Vector3.forward) < 0f)) ? 1 : (-1));
float num5 = num4;
if (Mathf.Abs(num5) > 0.05f)
{
totalRotation += num5;
}
if (totalRotation > 360f)
{
totalRotation -= 360f;
}
else if (totalRotation < 0f)
{
totalRotation += 360f;
}
if ((Object)(object)ExposedLiquidT != (Object)null)
{
Transform exposedLiquidT = ExposedLiquidT;
Vector3 val13 = cPos;
Vector3 val14 = anchor - cPos;
exposedLiquidT.position = val13 - ((Vector3)(ref val14)).normalized * finalLevel;
Transform exposedLiquidT2 = ExposedLiquidT;
Vector3 val15 = Vector3.one * texCurveSize.Evaluate(Mathf.Clamp01(level));
Vector3 lossyScale = ((Component)this).transform.lossyScale;
exposedLiquidT2.localScale = val15 * ((Vector3)(ref lossyScale)).magnitude * 0.001f * TextureSize * TextureSizeScalar;
Transform exposedLiquidT3 = ExposedLiquidT;
Vector3 val16 = finalPoint - finalAnchor;
exposedLiquidT3.up = ((Vector3)(ref val16)).normalized;
}
prevTransformedPoint = transformedPoint;
previous = ((Component)this).transform.rotation;
Vector4 val17 = Vector4.op_Implicit(((Component)this).transform.InverseTransformPoint(TopLeft));
Vector4 val18 = Vector4.op_Implicit(((Component)this).transform.InverseTransformPoint(TopRight));
Vector4 val19 = Vector4.op_Implicit(((Component)this).transform.InverseTransformPoint(BottomLeft));
Vector4 val20 = Vector4.op_Implicit(((Component)this).transform.InverseTransformPoint(BottomRight));
Transform transform2 = ((Component)this).transform;
Vector3 val21 = cPos;
Vector3 val22 = anchor - cPos;
Vector4 val23 = Vector4.op_Implicit(transform2.InverseTransformPoint(val21 - ((Vector3)(ref val22)).normalized * finalLevel));
for (int k = 0; k < mats.Length; k++)
{
if (shaderNames[k].Contains("_Texture"))
{
mats[k].SetVector("_TL", val17);
mats[k].SetVector("_TR", val18);
mats[k].SetVector("_BL", val19);
mats[k].SetVector("_BR", val20);
mats[k].SetVector("_CENTER", val23);
}
}
prvLevel = level;
prevQ = ((Component)this).transform.rotation;
}
}
public class MeshLiquidEmission : MonoBehaviour
{
[Serializable]
private class BVertex
{
public Vector3 p;
public Vector3 n;
public bool b;
}
[HideInInspector]
[SerializeField]
private MeshFilter r;
public LiquidVolumeAnimator LVA;
[HideInInspector]
[SerializeField]
private int[] calculatedTriangles;
[HideInInspector]
[SerializeField]
private BVertex[] calculatedVerts;
public ParticleSystem system;
private float particlesToEmit = 0f;
public float emissionSpeed = 0f;
private Mesh m;
[HideInInspector]
[SerializeField]
private int[] tris;
[HideInInspector]
[SerializeField]
private Vector3[] verts;
[HideInInspector]
[SerializeField]
private Vector3[] norms;
public bool debug = false;
public float debugScale = 1f;
public bool CullNullNormals = false;
public Rigidbody Cork;
public float volumeOfParticles = 70f;
public bool emitting = true;
public BottleSmash bottleSmash;
public float angleSpeedScalar = 1f;
private int CVOB = 0;
private void Start()
{
r = ((Component)this).GetComponent<MeshFilter>();
m = r.mesh;
calculatedVerts = new BVertex[m.vertexCount * 6];
for (int i = 0; i < calculatedVerts.Length; i++)
{
calculatedVerts[i] = new BVertex();
}
verts = m.vertices;
tris = m.triangles;
norms = m.normals;
}
private bool LinePlaneIntersection(Vector3 p0, Vector3 p1, Vector3 planePoint, Vector3 planeNormal, out Vector3 coordinate)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0059: 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_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = p1 - p0;
coordinate = Vector3.zero;
float num = Vector3.Dot(((Vector3)(ref planeNormal)).normalized, val);
if (Mathf.Abs(num) > float.Epsilon)
{
Vector3 val2 = p0 - planePoint;
float num2 = Vector3.Dot(((Vector3)(ref planeNormal)).normalized, val2) * -1f / num;
val *= num2;
coordinate = p0 + val;
return true;
}
return false;
}
private void OnDrawGizmos()
{
//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_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)
if (debug && calculatedVerts != null)
{
for (int i = 0; i < calculatedVerts.Length && calculatedVerts[i].b; i++)
{
Vector3 val = ((Component)this).transform.TransformPoint(calculatedVerts[i].p);
Vector3 lossyScale = ((Component)this).transform.lossyScale;
Gizmos.DrawSphere(val, 0.01f * ((Vector3)(ref lossyScale)).magnitude * debugScale);
}
}
}
private void SetDual(int under1, int under2, int above, ref Vector3 dir, ref Vector3 lpos, ref int currentVOB, ref Vector3 tmpV)
{
//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)
//IL_0037: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: 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_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: 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_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: 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_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: 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)
calculatedVerts[currentVOB].p = verts[under1];
calculatedVerts[currentVOB].n = norms[under1];
calculatedVerts[currentVOB].b = true;
LinePlaneIntersection(verts[under1], verts[above], lpos, dir * -1f, out tmpV);
calculatedVerts[currentVOB + 1].p = tmpV;
BVertex obj = calculatedVerts[currentVOB + 1];
Vector3 val = norms[under1];
Vector3 val2 = norms[above];
Vector3 val3 = tmpV - verts[under1];
float magnitude = ((Vector3)(ref val3)).magnitude;
Vector3 val4 = verts[under1] - verts[above];
obj.n = Vector3.Lerp(val, val2, magnitude / ((Vector3)(ref val4)).magnitude);
calculatedVerts[currentVOB + 1].b = true;
calculatedVerts[currentVOB + 2].p = verts[under2];
calculatedVerts[currentVOB + 2].n = norms[under2];
calculatedVerts[currentVOB + 2].b = true;
calculatedVerts[currentVOB + 3].p = verts[under2];
calculatedVerts[currentVOB + 3].n = norms[under2];
calculatedVerts[currentVOB + 3].b = true;
calculatedVerts[currentVOB + 4].p = tmpV;
calculatedVerts[currentVOB + 4].n = calculatedVerts[currentVOB + 1].n;
calculatedVerts[currentVOB + 4].b = true;
LinePlaneIntersection(verts[under2], verts[above], lpos, dir * -1f, out tmpV);
calculatedVerts[currentVOB + 5].p = tmpV;
BVertex obj2 = calculatedVerts[currentVOB + 5];
Vector3 val5 = norms[under2];
Vector3 val6 = norms[above];
Vector3 val7 = tmpV - verts[under2];
float magnitude2 = ((Vector3)(ref val7)).magnitude;
Vector3 val8 = verts[under2] - verts[above];
obj2.n = Vector3.Lerp(val5, val6, magnitude2 / ((Vector3)(ref val8)).magnitude);
calculatedVerts[currentVOB + 5].b = true;
}
private void SetDualInverted(int under1, int above1, int above2, ref Vector3 dir, ref Vector3 lpos, ref int currentVOB, ref Vector3 tmpV)
{
//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)
//IL_0037: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: 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_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
calculatedVerts[currentVOB].p = verts[under1];
calculatedVerts[currentVOB].n = norms[under1];
calculatedVerts[currentVOB].b = true;
LinePlaneIntersection(verts[under1], verts[above1], lpos, dir * -1f, out tmpV);
calculatedVerts[currentVOB + 1].p = tmpV;
BVertex obj = calculatedVerts[currentVOB + 1];
Vector3 val = norms[under1];
Vector3 val2 = norms[above1];
Vector3 val3 = tmpV - verts[under1];
float magnitude = ((Vector3)(ref val3)).magnitude;
Vector3 val4 = verts[under1] - verts[above1];
obj.n = Vector3.Lerp(val, val2, magnitude / ((Vector3)(ref val4)).magnitude);
calculatedVerts[currentVOB + 1].b = true;
LinePlaneIntersection(verts[under1], verts[above2], lpos, dir * -1f, out tmpV);
calculatedVerts[currentVOB + 2].p = tmpV;
BVertex obj2 = calculatedVerts[currentVOB + 2];
Vector3 val5 = norms[under1];
Vector3 val6 = norms[above2];
Vector3 val7 = tmpV - verts[under1];
float magnitude2 = ((Vector3)(ref val7)).magnitude;
Vector3 val8 = verts[under1] - verts[above2];
obj2.n = Vector3.Lerp(val5, val6, magnitude2 / ((Vector3)(ref val8)).magnitude);
calculatedVerts[currentVOB + 2].b = true;
}
private void CalculateTrianglesToEmitFrom(int[] tris, Vector3[] verts)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: 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_00e3: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = LVA.finalAnchor - LVA.finalPoint;
Vector3 normalized = ((Vector3)(ref val)).normalized;
Vector3 lpos = ((Component)this).transform.InverseTransformPoint(LVA.finalPoint);
Vector3 val2 = ((Component)this).transform.InverseTransformDirection(normalized);
normalized = ((Vector3)(ref val2)).normalized;
int currentVOB = 0;
Vector3 tmpV = Vector3.zero;
for (int i = 2; i < tris.Length; i += 3)
{
int num = tris[i - 2];
int num2 = tris[i - 1];
int num3 = tris[i];
Vector3 val3 = verts[num];
Vector3 val4 = verts[num2];
Vector3 val5 = verts[num3];
Vector3 val6 = val3 - lpos;
bool flag = Vector3.Dot(normalized, val6) >= 0f;
Vector3 val7 = val4 - lpos;
bool flag2 = Vector3.Dot(normalized, val7) >= 0f;
Vector3 val8 = val5 - lpos;
bool flag3 = Vector3.Dot(normalized, val8) >= 0f;
if (flag3 && flag2 && flag)
{
calculatedVerts[currentVOB].p = val3;
calculatedVerts[currentVOB].n = norms[num];
calculatedVerts[currentVOB].b = true;
calculatedVerts[currentVOB + 1].p = val4;
calculatedVerts[currentVOB + 1].n = norms[num2];
calculatedVerts[currentVOB + 1].b = true;
calculatedVerts[currentVOB + 2].p = val5;
calculatedVerts[currentVOB + 2].n = norms[num2];
calculatedVerts[currentVOB + 2].b = true;
currentVOB += 3;
}
else
{
if (!flag3 && !flag2 && !flag)
{
continue;
}
bool flag4 = false;
if (flag && flag2)
{
SetDual(num, num2, num3, ref normalized, ref lpos, ref currentVOB, ref tmpV);
currentVOB += 6;
flag4 = true;
}
if (flag && flag3)
{
SetDual(num, num3, num2, ref normalized, ref lpos, ref currentVOB, ref tmpV);
currentVOB += 6;
flag4 = true;
}
if (flag2 && flag3)
{
SetDual(num3, num2, num, ref normalized, ref lpos, ref currentVOB, ref tmpV);
currentVOB += 6;
flag4 = true;
}
if (!flag4)
{
if (flag)
{
SetDualInverted(num, num2, num3, ref normalized, ref lpos, ref currentVOB, ref tmpV);
currentVOB += 3;
}
else if (flag2)
{
SetDualInverted(num2, num, num3, ref normalized, ref lpos, ref currentVOB, ref tmpV);
currentVOB += 3;
}
else if (flag3)
{
SetDualInverted(num3, num2, num, ref normalized, ref lpos, ref currentVOB, ref tmpV);
currentVOB += 3;
}
}
}
}
if (currentVOB < calculatedVerts.Length)
{
calculatedVerts[currentVOB].b = false;
}
CVOB = currentVOB;
}
private float GetPS_StartSpeed()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_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)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected I4, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_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)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_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_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)
MainModule main = system.main;
MinMaxCurve startSpeed = ((MainModule)(ref main)).startSpeed;
ParticleSystemCurveMode mode = ((MinMaxCurve)(ref startSpeed)).mode;
switch ((int)mode)
{
case 3:
{
MainModule main5 = system.main;
MinMaxCurve startSpeed5 = ((MainModule)(ref main5)).startSpeed;
float constantMin = ((MinMaxCurve)(ref startSpeed5)).constantMin;
MainModule main6 = system.main;
MinMaxCurve startSpeed6 = ((MainModule)(ref main6)).startSpeed;
return Random.Range(constantMin, ((MinMaxCurve)(ref startSpeed6)).constantMax);
}
case 0:
{
MainModule main4 = system.main;
MinMaxCurve startSpeed4 = ((MainModule)(ref main4)).startSpeed;
return ((MinMaxCurve)(ref startSpeed4)).constant;
}
case 1:
{
MainModule main3 = system.main;
MinMaxCurve startSpeed3 = ((MainModule)(ref main3)).startSpeed;
return ((MinMaxCurve)(ref startSpeed3)).Evaluate(Random.value);
}
case 2:
{
MainModule main2 = system.main;
MinMaxCurve startSpeed2 = ((MainModule)(ref main2)).startSpeed;
return ((MinMaxCurve)(ref startSpeed2)).Evaluate(Random.value);
}
default:
return 0f;
}
}
private bool EmitFromSubmesh()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_004d: 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_0062: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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_009b: 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_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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: 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)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: 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_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
int num = Random.Range(0, CVOB / 3 - 1);
num *= 3;
float value = Random.value;
float value2 = Random.value;
Vector3 val = Vector3.Lerp(calculatedVerts[num].p, calculatedVerts[num + 1].p, value);
Vector3 val2 = Vector3.Lerp(calculatedVerts[num].n, calculatedVerts[num + 1].n, value);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
val = Vector3.Lerp(val, calculatedVerts[num + 2].p, value2);
Vector3 val3 = Vector3.Lerp(normalized, calculatedVerts[num + 2].n, value2);
normalized = ((Vector3)(ref val3)).normalized;
EmitParams val4 = default(EmitParams);
float num2 = 1f;
if ((Object)(object)bottleSmash != (Object)null)
{
Vector3 val5 = ((Component)this).transform.TransformDirection(normalized);
Vector3 normalized2 = ((Vector3)(ref val5)).normalized;
Vector3 val6 = LVA.finalAnchor - LVA.finalPoint;
num2 = (1f + Vector3.Dot(((Vector3)(ref val6)).normalized, normalized2)) / 2f;
((EmitParams)(ref val4)).velocity = normalized2 * GetPS_StartSpeed() * num2 * angleSpeedScalar;
}
else
{
Vector3 val7 = ((Component)this).transform.TransformDirection(normalized);
((EmitParams)(ref val4)).velocity = ((Vector3)(ref val7)).normalized * GetPS_StartSpeed();
}
((EmitParams)(ref val4)).position = ((Component)this).transform.TransformPoint(val);
if (((EmitParams)(ref val4)).velocity == Vector3.zero && CullNullNormals)
{
return false;
}
particlesToEmit -= 1f;
if ((Object)(object)Cork != (Object)null)
{
if (Cork.isKinematic && volumeOfParticles > 0f)
{
LVA.level = Mathf.Clamp01((volumeOfParticles * LVA.level - 1f) / volumeOfParticles);
}
}
else if (volumeOfParticles > 0f)
{
LVA.level = Mathf.Clamp01((volumeOfParticles * LVA.level - 1f) / volumeOfParticles);
}
system.Emit(val4, 1);
return true;
}
private void Update()
{
if (!emitting || (Object)(object)Cork != (Object)null || LVA.level <= 0f)
{
return;
}
CalculateTrianglesToEmitFrom(tris, verts);
particlesToEmit += emissionSpeed * Time.deltaTime;
if (calculatedVerts.Length == 0)
{
particlesToEmit = 0f;
}
else if (!calculatedVerts[0].b)
{
particlesToEmit = 0f;
}
int num = 10;
int num2 = num;
while (particlesToEmit > 0f && (GetPS_StartSpeed() > 0f || !CullNullNormals))
{
num2 = ((!EmitFromSubmesh()) ? (num2 - 1) : num);
if (num2 <= 0)
{
break;
}
}
}
}
public class ConveyImpacts : MonoBehaviour
{
public GhostPhysics _physics;
private void OnCollisionEnter(Collision collision)
{
_physics.SendCollision(collision);
}
}
public class GhostPhysics : MonoBehaviour
{
private BottleSmash _smash;
private Transform _ghost;
public GameObject _ghostObject;
public bool _redirectSelection = false;
[Header("Reference")]
public Transform _externalTransform;
private void Start()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
_smash = ((Component)this).GetComponent<BottleSmash>();
_ghost = Object.Instantiate<GameObject>(_ghostObject).transform;
_ghost.position = ((Component)this).transform.position;
_ghost.rotation = ((Component)this).transform.rotation;
_ghost.localScale = _smash.Glass.transform.localScale;
_externalTransform = _ghost;
MeshCollider component = ((Component)_ghost).gameObject.GetComponent<MeshCollider>();
component.sharedMesh = _smash.Glass.GetComponent<MeshFilter>().sharedMesh;
((Component)_ghost).GetComponent<ConveyImpacts>()._physics = this;
}
private void OnDestroy()
{
if ((Object)(object)_ghost != (Object)null)
{
Object.Destroy((Object)(object)((Component)_ghost).gameObject);
}
}
public void SendCollision(Collision col)
{
if ((Object)(object)_smash != (Object)null)
{
_smash.AttemptCollision(col);
}
}
public Transform GetController()
{
return _ghost;
}
private void Update()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_ghost != (Object)null)
{
((Component)this).transform.position = _ghost.position;
((Component)this).transform.rotation = _ghost.rotation;
}
if (_redirectSelection && (Object)(object)Selection.activeTransform == (Object)(object)((Component)this).transform)
{
Selection.activeTransform = _ghost;
}
}
}
public class PickUpPotion : MonoBehaviour
{
private GameObject Obj;
private Rigidbody rObj;
private float dist;
private float d;
public float offsetValue = 1f;
private Vector2 beginDist;
private void Start()
{
}
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or musing System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using OtherLoader;
using Sodalite.Api;
using UnityEngine;
[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]
namespace Alloy
{
public static class EnumExtension
{
public static bool HasFlag(this Enum keys, Enum flag)
{
int num = Convert.ToInt32(keys);
int num2 = Convert.ToInt32(flag);
return (num & num2) == num2;
}
}
}
namespace MeatKit
{
public class HideInNormalInspectorAttribute : PropertyAttribute
{
}
}
namespace NotWolfie.ModulMDR
{
[BepInPlugin("NotWolfie.ModulMDR", "ModulMDR", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
[BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")]
[BepInDependency("nrgill28.Sodalite", "1.4.1")]
public class ModulMDRPlugin : 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(), "NotWolfie.ModulMDR");
OtherLoader.RegisterDirectLoad(BasePath, "NotWolfie.ModulMDR", "", "", "modulmdr", "");
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modulmdr"));
}
}
}using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;
[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]
namespace Cityrobo
{
[RequireComponent(typeof(Minigun))]
public class MinigunMagazineCompatibility : MonoBehaviour
{
private static readonly List<Minigun> _patchedMiniguns;
private Minigun _minigun;
static MinigunMagazineCompatibility()
{
_patchedMiniguns = new List<Minigun>();
Harmony.CreateAndPatchAll(typeof(MinigunMagazineCompatibility), (string)null);
}
public void Awake()
{
_minigun = ((Component)this).GetComponent<Minigun>();
_patchedMiniguns.Add(_minigun);
}
public void OnDestroy()
{
_patchedMiniguns.Remove(_minigun);
}
[HarmonyPatch(typeof(Minigun), "LoadRoundFromMag")]
[HarmonyPrefix]
private static bool Minigun_LoadRoundFromMag(Minigun __instance)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
if (_patchedMiniguns.Contains(__instance))
{
FVRFireArmMagazine magazine = ((FVRFireArm)__instance).Magazine;
if (magazine.HasARound())
{
FVRLoadedRound val = magazine.RemoveRound(0);
__instance.LoadedRounds[__instance.m_numBullets].LR_Class = val.LR_Class;
__instance.LoadedRounds[__instance.m_numBullets].LR_Mesh = val.LR_Mesh;
__instance.LoadedRounds[__instance.m_numBullets].LR_Material = val.LR_Material;
__instance.LoadedRounds[__instance.m_numBullets].LR_ProjectilePrefab = ((AnvilAsset)val.LR_ObjectWrapper).GetGameObject().GetComponent<FVRFireArmRound>().BallisticProjectilePrefab;
__instance.m_numBullets++;
__instance.UpdateDisplay();
}
return false;
}
return true;
}
}
}
namespace Billiam_J_McGoonigan.Bubba_Minigun
{
[BepInPlugin("Billiam_J_McGoonigan.Bubba_Minigun", "Bubba_Minigun", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Bubba_MinigunPlugin : 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_McGoonigan.Bubba_Minigun");
OtherLoader.RegisterDirectLoad(BasePath, "Billiam_J_McGoonigan.Bubba_Minigun", "", "", "minigatling", "");
}
}
}
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<Transform> 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<WheelCollider>();
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<Rigidbody>();
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<AudioSource>().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<AudioSource>().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<AudioSource>().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>()))
{
VehicleControl component = ((Component)collision.transform.root).GetComponent<VehicleControl>();
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<VehicleControl>()))
{
((Component)collision.transform.root).GetComponent<VehicleControl>().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<AudioSource>().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<GameObject>(carParticles.brakeParticlePerfab, wheelComponent.wheel.position, Quaternion.identity);
((Object)Particle[num3]).name = "WheelParticle";
Particle[num3].transform.parent = ((Component)this).transform;
Particle[num3].AddComponent<AudioSource>();
Particle[num3].GetComponent<AudioSource>().maxDistance = 50f;
Particle[num3].GetComponent<AudioSource>().spatialBlend = 1f;
Particle[num3].GetComponent<AudioSource>().dopplerLevel = 5f;
Particle[num3].GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)2;
}
ParticleSystem component = Particle[num3].GetComponent<ParticleSystem>();
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<AudioSource>().clip = carSetting.hitGround[l].brakeSound;
}
else if ((Object)(object)Particle[num3].GetComponent<AudioSource>().clip != (Object)(object)carSetting.hitGround[l].groundSound && !Particle[num3].GetComponent<AudioSource>().isPlaying)
{
Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[l].groundSound;
}
Particle[num3].GetComponent<ParticleSystem>().startColor = carSetting.hitGround[l].brakeColor;
}
}
if (flag2 && speed > 5f && !brake)
{
component.enableEmission = true;
Particle[num3].GetComponent<AudioSource>().volume = 0.5f;
if (!Particle[num3].GetComponent<AudioSource>().isPlaying)
{
Particle[num3].GetComponent<AudioSource>().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<AudioSource>().isPlaying)
{
Particle[num3].GetComponent<AudioSource>().Play();
}
component.enableEmission = true;
Particle[num3].GetComponent<AudioSource>().volume = 10f;
}
}
else
{
component.enableEmission = false;
Particle[num3].GetComponent<AudioSource>().volume = Mathf.Lerp(Particle[num3].GetComponent<AudioSource>().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<ParticleSystem>();
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);
}
}
}using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using OtherLoader;
using UnityEngine;
[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]
namespace Billiam_J_McHooligan.Remington_Elliot;
[BepInPlugin("Billiam_J_McHooligan.Remington_Elliot", "Remington_Elliot", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Remington_ElliotPlugin : 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.Remington_Elliot");
OtherLoader.RegisterDirectLoad(BasePath, "Billiam_J_McHooligan.Remington_Elliot", "", "", "remingtonelliot", "");
}
}
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<Transform> 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<WheelCollider>();
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<Rigidbody>();
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<AudioSource>().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<AudioSource>().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<AudioSource>().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>()))
{
VehicleControl component = ((Component)collision.transform.root).GetComponent<VehicleControl>();
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<VehicleControl>()))
{
((Component)collision.transform.root).GetComponent<VehicleControl>().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<AudioSource>().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<GameObject>(carParticles.brakeParticlePerfab, wheelComponent.wheel.position, Quaternion.identity);
((Object)Particle[num3]).name = "WheelParticle";
Particle[num3].transform.parent = ((Component)this).transform;
Particle[num3].AddComponent<AudioSource>();
Particle[num3].GetComponent<AudioSource>().maxDistance = 50f;
Particle[num3].GetComponent<AudioSource>().spatialBlend = 1f;
Particle[num3].GetComponent<AudioSource>().dopplerLevel = 5f;
Particle[num3].GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)2;
}
ParticleSystem component = Particle[num3].GetComponent<ParticleSystem>();
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<AudioSource>().clip = carSetting.hitGround[l].brakeSound;
}
else if ((Object)(object)Particle[num3].GetComponent<AudioSource>().clip != (Object)(object)carSetting.hitGround[l].groundSound && !Particle[num3].GetComponent<AudioSource>().isPlaying)
{
Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[l].groundSound;
}
Particle[num3].GetComponent<ParticleSystem>().startColor = carSetting.hitGround[l].brakeColor;
}
}
if (flag2 && speed > 5f && !brake)
{
component.enableEmission = true;
Particle[num3].GetComponent<AudioSource>().volume = 0.5f;
if (!Particle[num3].GetComponent<AudioSource>().isPlaying)
{
Particle[num3].GetComponent<AudioSource>().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<AudioSource>().isPlaying)
{
Particle[num3].GetComponent<AudioSource>().Play();
}
component.enableEmission = true;
Particle[num3].GetComponent<AudioSource>().volume = 10f;
}
}
else
{
component.enableEmission = false;
Particle[num3].GetComponent<AudioSource>().volume = Mathf.Lerp(Particle[num3].GetComponent<AudioSource>().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<ParticleSystem>();
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);
}
}
}