using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OpenScripts2;
using OtherLoader;
using Sodalite.Api;
using Sodalite.Utilities;
using UnityEditor;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;
using VolksScripts;
[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 VolksScripts
{
public class NVGPowerSwitch : FVRInteractiveObject
{
public PIPScope Scope;
[HideInInspector]
public bool Toggle = true;
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).SimpleInteraction(hand);
SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton<SM>.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position);
if (Toggle)
{
Scope.enableNightvision = (Scope.enableThermal = false);
}
else
{
Scope.enableNightvision = (Scope.enableThermal = true);
}
Toggle = !Toggle;
}
}
public class ANVIS21Control : MonoBehaviour
{
[Header("References")]
public PIPScope scope;
public Transform NVGObject;
[Header("Positions")]
public Vector3 OnLocalPosition;
public Vector3 OffLocalPosition;
public Vector3 OnLocalRotation;
public Vector3 OffLocalRotation;
[Header("Transition")]
public float TransitionSpeed = 5f;
[Header("Power State")]
public bool IsPoweredOn = false;
private Vector3 targetPos;
private Quaternion targetRot;
private void Start()
{
SetState(IsPoweredOn, instant: true);
}
private void Update()
{
//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_0036: 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_0063: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)NVGObject != (Object)null)
{
NVGObject.localPosition = Vector3.Lerp(NVGObject.localPosition, targetPos, Time.deltaTime * TransitionSpeed);
NVGObject.localRotation = Quaternion.Slerp(NVGObject.localRotation, targetRot, Time.deltaTime * TransitionSpeed);
}
if ((Object)(object)scope != (Object)null)
{
((Behaviour)scope).enabled = IsPoweredOn;
}
}
public void TogglePower()
{
SetState(!IsPoweredOn, instant: false);
}
public void SetState(bool on, bool instant)
{
//IL_0035: 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_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_004b: 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_0016: 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_0022: 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_0070: 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)
IsPoweredOn = on;
if (on)
{
targetPos = OnLocalPosition;
targetRot = Quaternion.Euler(OnLocalRotation);
}
else
{
targetPos = OffLocalPosition;
targetRot = Quaternion.Euler(OffLocalRotation);
}
if (instant && (Object)(object)NVGObject != (Object)null)
{
NVGObject.localPosition = targetPos;
NVGObject.localRotation = targetRot;
}
if ((Object)(object)scope != (Object)null)
{
((Behaviour)scope).enabled = on;
}
}
private void OnTriggerEnter(Collider other)
{
TogglePower();
}
}
}
public class ForceBindToHead : MonoBehaviour
{
[Tooltip("The object that should follow the player's head (e.g. NVG physical root).")]
public GameObject phys;
[Tooltip("Optional: if true, runs even when not equipped.")]
public bool alwaysFollow = true;
private Transform headTransform;
private void Start()
{
if ((Object)(object)GM.CurrentMovementManager != (Object)null && (Object)(object)GM.CurrentMovementManager.Head != (Object)null)
{
headTransform = ((Component)GM.CurrentMovementManager.Head).transform;
}
else
{
Debug.LogWarning((object)"[ForceBindToHead] Could not find head transform.");
}
}
private void FixedUpdate()
{
//IL_00ac: 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)
if (!((Object)(object)phys == (Object)null) && (alwaysFollow || !((Object)(object)headTransform == (Object)null)))
{
if ((Object)(object)headTransform == (Object)null && (Object)(object)GM.CurrentMovementManager != (Object)null)
{
headTransform = ((Component)GM.CurrentMovementManager.Head).transform;
}
if ((Object)(object)phys.transform.parent != (Object)(object)headTransform)
{
phys.transform.SetParent(headTransform);
}
phys.transform.localPosition = Vector3.zero;
phys.transform.localEulerAngles = Vector3.zero;
}
}
}
namespace JerryComponent
{
public class PNV57EControl : MonoBehaviour
{
public GameObject phys;
public GameObject armreal;
public GameObject armfake;
public Vector3 velLinearWorldL;
public Vector3 velLinearWorldR;
public Transform slapdirUP;
public Transform slapdirDown;
public HeadAttachment HA;
public PIPScope scopeL;
public PIPScope scopeR;
public GameObject powerknob;
public float refgain;
public float reflum;
public AudioEvent flip;
public bool started = false;
public float onspeed = 0.5f;
public float offspeed = 2.5f;
public bool isheadmounted = true;
public AudioSource whing;
public float volref;
private void Start()
{
scopeL.nvDef.nightVisionTargetBrightness = 0f;
scopeL.nightVisionManualGainFactor = 0f;
scopeR.nvDef.nightVisionTargetBrightness = 0f;
scopeR.nightVisionManualGainFactor = 0f;
refgain = 0f;
reflum = 0f;
volref = 0f;
whing.volume = 0f;
whing.pitch = 0f;
}
private void FixedUpdate()
{
//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
//IL_03ee: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0535: Unknown result type (might be due to invalid IL or missing references)
//IL_053a: 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)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Invalid comparison between Unknown and I4
//IL_011e: 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_0281: 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_01eb: 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_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Invalid comparison between Unknown and I4
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: 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_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_035e: Unknown result type (might be due to invalid IL or missing references)
//IL_0369: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: 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_0191: 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_0389: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
((Behaviour)scopeL).enabled = true;
scopeL.UpdateParameters();
((Behaviour)scopeR).enabled = true;
scopeR.UpdateParameters();
if (isheadmounted)
{
armfake.transform.localEulerAngles = armreal.transform.localEulerAngles;
phys.transform.SetParent(((Component)GM.CurrentMovementManager.Head).gameObject.transform);
phys.transform.localPosition = Vector3.zero;
phys.transform.localEulerAngles = Vector3.zero;
velLinearWorldL = GM.CurrentMovementManager.Hands[0].Input.VelLinearWorld;
velLinearWorldR = GM.CurrentMovementManager.Hands[1].Input.VelLinearWorld;
if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f)
{
HA.ToggleFlip();
SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position);
}
else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f)
{
HA.ToggleFlip();
SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position);
}
if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f)
{
HA.ToggleFlip();
SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position);
}
else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f)
{
HA.ToggleFlip();
SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position);
}
}
if (powerknob.transform.localEulerAngles.x > 15f)
{
scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed);
scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 0f, ref reflum, offspeed);
scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed);
scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 0f, ref reflum, offspeed);
whing.volume = Mathf.SmoothDamp(whing.volume, 0f, ref volref, offspeed);
whing.pitch = Mathf.SmoothDamp(whing.pitch, 0f, ref volref, offspeed);
started = false;
}
else if (powerknob.transform.localEulerAngles.x < 15f)
{
scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 1f, ref reflum, onspeed);
scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 1f, ref reflum, onspeed);
whing.volume = Mathf.SmoothDamp(whing.volume, 0.5f, ref volref, onspeed);
whing.pitch = Mathf.SmoothDamp(whing.pitch, 1.3f, ref volref, onspeed);
if (!started)
{
scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed);
scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed);
}
if (scopeL.nvDef.nightVisionTargetBrightness > 0.9f && scopeR.nvDef.nightVisionTargetBrightness > 0.9f)
{
started = true;
}
}
}
private void OnDestroy()
{
Object.Destroy((Object)(object)phys);
}
}
public class PNV57EControlAdj : MonoBehaviour
{
public GameObject phys;
public PIPScope scopeL;
public PIPScope scopeR;
public GameObject powerknob;
public float refgain;
public float reflum;
public AudioEvent flip;
public bool started = false;
public float onspeed = 0.5f;
public float offspeed = 2.5f;
public bool isheadmounted = true;
public AudioSource whing;
public float volref;
public float pitref;
public float volume;
public float pitch;
public GameObject root;
public int scopePara;
private void Start()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
scopePara = GM.Options.SimulationOptions.ScopeRecursiveRendering;
GM.Options.SimulationOptions.ScopeRecursiveRendering = 0;
GM.RefreshQuality();
powerknob.transform.localEulerAngles = new Vector3(30f, 0f, 0f);
scopeL.nvDef.nightVisionTargetBrightness = 0f;
scopeL.nightVisionManualGainFactor = 0f;
scopeR.nvDef.nightVisionTargetBrightness = 0f;
scopeR.nightVisionManualGainFactor = 0f;
refgain = 0f;
reflum = 0f;
volref = 0f;
pitref = 0f;
whing.volume = 0f;
whing.pitch = 0f;
}
private void FixedUpdate()
{
//IL_001b: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_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)
root.transform.localPosition = new Vector3(0f, 0f, 0f);
((Behaviour)scopeL).enabled = true;
scopeL.UpdateParameters();
((Behaviour)scopeR).enabled = true;
scopeR.UpdateParameters();
if (isheadmounted)
{
phys.transform.SetParent(((Component)GM.CurrentMovementManager.Head).gameObject.transform);
phys.transform.localPosition = Vector3.zero;
phys.transform.localEulerAngles = Vector3.zero;
}
if (powerknob.transform.localEulerAngles.x > 15f)
{
scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed);
scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 0f, ref reflum, offspeed);
scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed);
scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 0f, ref reflum, offspeed);
whing.volume = Mathf.SmoothDamp(whing.volume, 0f, ref volref, offspeed);
whing.pitch = Mathf.SmoothDamp(whing.pitch, 0f, ref pitref, offspeed);
started = false;
}
else if (powerknob.transform.localEulerAngles.x < 15f)
{
scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 1f, ref reflum, onspeed);
scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 1f, ref reflum, onspeed);
whing.volume = Mathf.SmoothDamp(whing.volume, volume, ref volref, onspeed);
whing.pitch = Mathf.SmoothDamp(whing.pitch, pitch, ref pitref, onspeed);
if (!started)
{
scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed);
scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed);
}
if (scopeL.nvDef.nightVisionTargetBrightness > 0.9f && scopeR.nvDef.nightVisionTargetBrightness > 0.9f)
{
started = true;
}
}
}
private void OnDestroy()
{
Object.Destroy((Object)(object)phys);
GM.Options.SimulationOptions.ScopeRecursiveRendering = scopePara;
GM.RefreshQuality();
}
}
public class PVS7Control : MonoBehaviour
{
public GameObject phys;
public GameObject armreal;
public GameObject armfake;
public Vector3 velLinearWorldL;
public Vector3 velLinearWorldR;
public Transform slapdirUP;
public Transform slapdirDown;
public HeadAttachment HA;
public PIPScope scope;
public GameObject powerknob;
public float refgain;
public float reflum;
public AudioEvent flip;
public bool started = false;
public float onspeed = 0.5f;
public float offspeed = 2.5f;
public bool isheadmounted = true;
private void Start()
{
scope.nvDef.nightVisionTargetBrightness = 0f;
scope.nightVisionManualGainFactor = 0f;
refgain = 0f;
reflum = 0f;
}
private void FixedUpdate()
{
//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: 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_0073: 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_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_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_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_0469: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Invalid comparison between Unknown and I4
//IL_0107: 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_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: 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_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Invalid comparison between Unknown and I4
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: 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_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
((Behaviour)scope).enabled = true;
scope.UpdateParameters();
if (isheadmounted)
{
armfake.transform.localEulerAngles = armreal.transform.localEulerAngles;
phys.transform.SetParent(((Component)GM.CurrentMovementManager.Head).gameObject.transform);
phys.transform.localPosition = Vector3.zero;
phys.transform.localEulerAngles = Vector3.zero;
velLinearWorldL = GM.CurrentMovementManager.Hands[0].Input.VelLinearWorld;
velLinearWorldR = GM.CurrentMovementManager.Hands[1].Input.VelLinearWorld;
if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f)
{
HA.ToggleFlip();
SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position);
}
else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f)
{
HA.ToggleFlip();
SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position);
}
if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f)
{
HA.ToggleFlip();
SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position);
}
else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f)
{
HA.ToggleFlip();
SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position);
}
}
if (powerknob.transform.localEulerAngles.x > 15f)
{
scope.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scope.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed);
scope.nightVisionManualGainFactor = Mathf.SmoothDamp(scope.nightVisionManualGainFactor, 0f, ref reflum, offspeed);
started = false;
}
else if (powerknob.transform.localEulerAngles.x < 15f)
{
scope.nightVisionManualGainFactor = Mathf.SmoothDamp(scope.nightVisionManualGainFactor, 1f, ref reflum, onspeed);
if (!started)
{
scope.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scope.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed);
}
if (scope.nvDef.nightVisionTargetBrightness > 0.9f)
{
started = true;
}
}
}
private void OnDestroy()
{
Object.Destroy((Object)(object)phys);
}
}
}
namespace VolksScripts
{
public class Bulletholder : FVRPhysicalObject
{
[Header("Bullet Slots")]
[Tooltip("Positions where rounds will be placed. Order defines fill order.")]
public List<Transform> BulletSlots = new List<Transform>();
[Header("Visuals (optional)")]
public MeshRenderer SlotHighlight;
[Header("Behaviors")]
public bool ClearVelocityOnPlace = true;
[Header("Capacity")]
public int capacity = 8;
private FVRFireArmRound[] _storedRounds;
public int NumRounds { get; private set; }
protected void Awake()
{
((FVRPhysicalObject)this).Awake();
if (BulletSlots == null)
{
BulletSlots = new List<Transform>();
}
_storedRounds = (FVRFireArmRound[])(object)new FVRFireArmRound[capacity];
NumRounds = 0;
UpdateBulletDisplay();
}
public bool TryPlace(FVRFireArmRound round)
{
if ((Object)(object)round == (Object)null || NumRounds >= capacity)
{
return false;
}
int num = FindFirstFreeSlot();
if (num < 0)
{
return false;
}
return PlaceAtIndex(round, num);
}
public bool PlaceAtIndex(FVRFireArmRound round, int index)
{
if ((Object)(object)round == (Object)null || index < 0 || index >= capacity)
{
return false;
}
if ((Object)(object)_storedRounds[index] != (Object)null)
{
return false;
}
PlaceAtSlot(round, BulletSlots[index]);
_storedRounds[index] = round;
NumRounds++;
UpdateBulletDisplay();
return true;
}
public FVRFireArmRound RemoveAt(int index)
{
if (index < 0 || index >= capacity)
{
return null;
}
FVRFireArmRound val = _storedRounds[index];
if ((Object)(object)val != (Object)null)
{
_storedRounds[index] = null;
NumRounds--;
UpdateBulletDisplay();
}
return val;
}
public FVRFireArmRound GetAt(int index)
{
if (index < 0 || index >= capacity)
{
return null;
}
return _storedRounds[index];
}
public void ClearAll()
{
for (int i = 0; i < capacity; i++)
{
_storedRounds[i] = null;
}
NumRounds = 0;
UpdateBulletDisplay();
}
private void PlaceAtSlot(FVRFireArmRound round, Transform slot)
{
//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_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_0071: 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_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: 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_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_00d1: 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_00d7: 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_00e0: 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_00ef: 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_00f6: 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_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_0147: Unknown result type (might be due to invalid IL or missing references)
Vector3 up = ((Component)this).transform.up;
Rigidbody val = ((!((Object)(object)((FVRPhysicalObject)round).RootRigidbody != (Object)null)) ? ((Component)round).GetComponent<Rigidbody>() : ((FVRPhysicalObject)round).RootRigidbody);
if ((Object)(object)val != (Object)null && ClearVelocityOnPlace)
{
val.velocity = Vector3.zero;
val.angularVelocity = Vector3.zero;
}
((Component)round).transform.rotation = Quaternion.LookRotation(((Component)this).transform.forward, up);
if (TryGetBaseAndTipAlongUp(round, up, out var baseAlongUp, out var _))
{
float num = Vector3.Dot(slot.position, up);
float num2 = num - baseAlongUp;
Transform transform = ((Component)round).transform;
transform.position += up * num2;
Collider componentInChildren = ((Component)round).GetComponentInChildren<Collider>();
Bounds bounds = componentInChildren.bounds;
Vector3 val2 = Vector3.ProjectOnPlane(slot.position, up);
Vector3 val3 = Vector3.ProjectOnPlane(((Bounds)(ref bounds)).center, up);
Vector3 val4 = val2 - val3;
Transform transform2 = ((Component)round).transform;
transform2.position += val4;
}
else
{
((Component)round).transform.position = slot.position;
}
if ((Object)(object)SlotHighlight != (Object)null)
{
((Component)SlotHighlight).transform.position = slot.position;
}
}
private bool TryGetBaseAndTipAlongUp(FVRFireArmRound round, Vector3 up, out float baseAlongUp, out float tipAlongUp)
{
//IL_0029: 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)
//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_0042: 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)
baseAlongUp = (tipAlongUp = 0f);
Collider componentInChildren = ((Component)round).GetComponentInChildren<Collider>();
if ((Object)(object)componentInChildren == (Object)null)
{
return false;
}
Bounds bounds = componentInChildren.bounds;
baseAlongUp = Vector3.Dot(((Bounds)(ref bounds)).min, up);
tipAlongUp = Vector3.Dot(((Bounds)(ref bounds)).max, up);
return true;
}
private int FindFirstFreeSlot()
{
for (int i = 0; i < capacity; i++)
{
if ((Object)(object)_storedRounds[i] == (Object)null)
{
return i;
}
}
return -1;
}
public void UpdateBulletDisplay()
{
for (int i = 0; i < BulletSlots.Count; i++)
{
if ((Object)(object)BulletSlots[i] != (Object)null)
{
}
}
}
}
public class BulletholderReloadTrigger : MonoBehaviour
{
public Bulletholder Holder;
private void OnTriggerEnter(Collider other)
{
Debug.Log((object)("Trigger entered by: " + ((Object)other).name));
FVRFireArmRound component = ((Component)other).GetComponent<FVRFireArmRound>();
if ((Object)(object)component != (Object)null && (Object)(object)Holder != (Object)null)
{
Holder.TryPlace(component);
}
}
}
}
public class Compass : FVRPhysicalObject
{
[Header("Compass Lid")]
public Transform Lid;
public float openRotationX = 90f;
public float openRotationY = 0f;
public float openRotationZ = 0f;
public float closeRotationX = 0f;
public float closeRotationY = 0f;
public float closeRotationZ = 0f;
public float lidRotationSpeed = 5f;
public AudioSource openCloseAudioSource;
public AudioClip openClip;
public AudioClip closeClip;
[Header("Compass Needle")]
public Transform Needle;
[Tooltip("The direction that is considered North. Default is (0,0,1) (Z+).")]
public Vector3 NorthDirection = Vector3.forward;
public float needleSmoothTime = 0.5f;
public float needleWobbleAmount = 2f;
public float needleWobbleSpeed = 5f;
private bool isOpen = false;
private bool isTouching = false;
private Vector2 initTouch = Vector2.zero;
private Vector2 lastTouchPoint = Vector2.zero;
private float currentNeedleAngle = 0f;
private float needleVelocity = 0f;
private void Update()
{
//IL_003a: 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_003f: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//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_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_00a9: 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_00af: 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_00ba: 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_00bc: 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_00cb: 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_0135: Unknown result type (might be due to invalid IL or missing references)
Quaternion val = ((!isOpen) ? Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ) : Quaternion.Euler(openRotationX, openRotationY, openRotationZ));
if ((Object)(object)Lid != (Object)null)
{
Lid.localRotation = Quaternion.Lerp(Lid.localRotation, val, Time.deltaTime * lidRotationSpeed);
}
if ((Object)(object)Needle != (Object)null)
{
Vector3 normalized = ((Vector3)(ref NorthDirection)).normalized;
Vector3 val2 = Vector3.ProjectOnPlane(((Component)this).transform.forward, Vector3.up);
Vector3 val3 = Vector3.ProjectOnPlane(normalized, Vector3.up);
float num = Mathf.Atan2(Vector3.Cross(val2, val3).y, Vector3.Dot(val2, val3)) * 57.29578f;
float num2 = Mathf.Sin(Time.time * needleWobbleSpeed) * needleWobbleAmount;
num += num2;
currentNeedleAngle = Mathf.SmoothDampAngle(currentNeedleAngle, num, ref needleVelocity, needleSmoothTime);
Needle.localRotation = Quaternion.Euler(0f, currentNeedleAngle, 0f);
}
}
public void ToggleLid()
{
isOpen = !isOpen;
if ((Object)(object)openCloseAudioSource != (Object)null)
{
openCloseAudioSource.PlayOneShot((!isOpen) ? closeClip : openClip);
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//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_0064: 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_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_00bc: 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_00c3: 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_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_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: 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)
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonDown || hand.Input.AXButtonDown)
{
ToggleLid();
}
return;
}
if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero)
{
isTouching = true;
initTouch = hand.Input.TouchpadAxes;
}
if (hand.Input.TouchpadTouchUp && isTouching)
{
isTouching = false;
Vector2 val = lastTouchPoint;
float y = (val - initTouch).y;
if (y > 0.5f || y < -0.5f)
{
ToggleLid();
}
initTouch = Vector2.zero;
val = Vector2.zero;
}
lastTouchPoint = hand.Input.TouchpadAxes;
}
}
public class FlamethrowerValve : FVRInteractiveObject
{
[Header("References")]
public Transform RefFrame;
public Transform Valve;
[Header("Rotation Settings")]
public Vector2 ValveRotRange = new Vector2(-50f, 50f);
private float m_valveRot;
[Header("Runtime")]
public float Lerp = 0.5f;
private Vector3 refDir = Vector3.one;
public override void BeginInteraction(FVRViveHand hand)
{
//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_000e: 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)
//IL_001f: 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_0027: Unknown result type (might be due to invalid IL or missing references)
Vector3 up = ((HandInput)(ref hand.Input)).Up;
Vector3 val = Vector3.ProjectOnPlane(up, RefFrame.right);
refDir = ((Vector3)(ref val)).normalized;
((FVRInteractiveObject)this).BeginInteraction(hand);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//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_000d: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_00e9: 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)
Vector3 up = ((HandInput)(ref hand.Input)).Up;
Vector3 val = Vector3.ProjectOnPlane(up, RefFrame.right);
Vector3 normalized = ((Vector3)(ref val)).normalized;
float num = Mathf.Atan2(Vector3.Dot(RefFrame.right, Vector3.Cross(refDir, normalized)), Vector3.Dot(refDir, normalized)) * 57.29578f;
num = Mathf.Clamp(num, -5f, 5f);
m_valveRot += num;
m_valveRot = Mathf.Clamp(m_valveRot, ValveRotRange.x, ValveRotRange.y);
Valve.localEulerAngles = new Vector3(m_valveRot, 0f, 0f);
Lerp = Mathf.InverseLerp(ValveRotRange.x, ValveRotRange.y, m_valveRot);
refDir = normalized;
((FVRInteractiveObject)this).UpdateInteraction(hand);
}
}
public class FlareBody : FVRPhysicalObject
{
[Header("Flare Parts")]
public GameObject FlareHead;
public Transform HeadAttachPoint;
public Collider StrikeArea;
[Header("Ignition")]
public int StrikesToIgnite = 3;
public float StrikeCooldown = 0.2f;
[Header("Effects")]
public ParticleSystem FlareParticles;
public Light FlareLight;
public AudioSource IgniteSound;
public AudioSource BurnLoopSound;
public AudioSource DieSound;
[Header("Lifetime")]
public float FlareLifetime = 20f;
private int m_strikeCount = 0;
private bool m_isHeadAttached = true;
private bool m_isIgnited = false;
private float m_lastStrikeTime = -1f;
private Coroutine m_lifetimeCoroutine;
protected void Awake()
{
((FVRPhysicalObject)this).Awake();
AttachHead();
if ((Object)(object)FlareParticles != (Object)null)
{
FlareParticles.Stop();
}
if ((Object)(object)FlareLight != (Object)null)
{
((Behaviour)FlareLight).enabled = false;
}
if ((Object)(object)BurnLoopSound != (Object)null)
{
BurnLoopSound.Stop();
}
}
public void DetachHead()
{
if (!m_isHeadAttached)
{
return;
}
m_isHeadAttached = false;
if ((Object)(object)FlareHead != (Object)null)
{
FlareHead.transform.parent = null;
Rigidbody component = FlareHead.GetComponent<Rigidbody>();
if ((Object)(object)component != (Object)null)
{
component.isKinematic = false;
}
}
}
public void AttachHead()
{
//IL_004c: 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)
m_isHeadAttached = true;
if ((Object)(object)FlareHead != (Object)null && (Object)(object)HeadAttachPoint != (Object)null)
{
FlareHead.transform.parent = HeadAttachPoint;
FlareHead.transform.localPosition = Vector3.zero;
FlareHead.transform.localRotation = Quaternion.identity;
Rigidbody component = FlareHead.GetComponent<Rigidbody>();
if ((Object)(object)component != (Object)null)
{
component.isKinematic = true;
}
}
}
public void Strike()
{
if (!m_isIgnited && !m_isHeadAttached && !(Time.time - m_lastStrikeTime < StrikeCooldown))
{
m_lastStrikeTime = Time.time;
m_strikeCount++;
if (m_strikeCount >= StrikesToIgnite)
{
Ignite();
}
}
}
private void Ignite()
{
m_isIgnited = true;
if ((Object)(object)FlareParticles != (Object)null)
{
FlareParticles.Play();
}
if ((Object)(object)FlareLight != (Object)null)
{
((Behaviour)FlareLight).enabled = true;
}
if ((Object)(object)IgniteSound != (Object)null)
{
IgniteSound.Play();
}
if ((Object)(object)BurnLoopSound != (Object)null)
{
BurnLoopSound.loop = true;
BurnLoopSound.Play();
}
if ((Object)(object)FlareHead != (Object)null)
{
Object.Destroy((Object)(object)FlareHead);
}
if (m_lifetimeCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(m_lifetimeCoroutine);
}
m_lifetimeCoroutine = ((MonoBehaviour)this).StartCoroutine(FlareLifeCoroutine());
}
private IEnumerator FlareLifeCoroutine()
{
yield return (object)new WaitForSeconds(FlareLifetime);
if ((Object)(object)BurnLoopSound != (Object)null)
{
BurnLoopSound.Stop();
}
if ((Object)(object)DieSound != (Object)null)
{
DieSound.Play();
}
if ((Object)(object)FlareParticles != (Object)null)
{
FlareParticles.Stop();
}
if ((Object)(object)FlareLight != (Object)null)
{
((Behaviour)FlareLight).enabled = false;
}
float dieSoundLength = ((!((Object)(object)DieSound != (Object)null) || !((Object)(object)DieSound.clip != (Object)null)) ? 0f : DieSound.clip.length);
yield return (object)new WaitForSeconds(dieSoundLength);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
public override void OnCollisionEnter(Collision col)
{
//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)
((FVRPhysicalObject)this).OnCollisionEnter(col);
if (m_isHeadAttached || m_isIgnited || !((Object)(object)StrikeArea != (Object)null))
{
return;
}
ContactPoint[] contacts = col.contacts;
for (int i = 0; i < contacts.Length; i++)
{
ContactPoint val = contacts[i];
if (((Object)(object)((ContactPoint)(ref val)).thisCollider == (Object)(object)StrikeArea || (Object)(object)((ContactPoint)(ref val)).otherCollider == (Object)(object)StrikeArea) && (((Object)(object)((ContactPoint)(ref val)).thisCollider != (Object)null && (Object)(object)((Component)((ContactPoint)(ref val)).thisCollider).gameObject.GetComponent<FlareHead>() != (Object)null) || ((Object)(object)((ContactPoint)(ref val)).otherCollider != (Object)null && (Object)(object)((Component)((ContactPoint)(ref val)).otherCollider).gameObject.GetComponent<FlareHead>() != (Object)null)))
{
Strike();
break;
}
}
}
}
public class FlareHead : FVRPhysicalObject
{
}
public class FlyingHotdog : MonoBehaviour
{
[Tooltip("Seconds to wait before the hotdog starts flying.")]
public float waitTime = 2f;
[Header("Speed Settings")]
[Tooltip("Minimum speed the hotdog can fly.")]
public float minFlySpeed = 3f;
[Tooltip("Maximum speed the hotdog can fly.")]
public float maxFlySpeed = 7f;
[Tooltip("How often the hotdog changes direction (seconds).")]
public float directionChangeInterval = 1f;
[Tooltip("How much the hotdog can move up or down per direction change.")]
public float verticalVariance = 2f;
[Tooltip("How quickly the hotdog turns toward its new direction. Higher = snappier.")]
public float turnSpeed = 1.2f;
[Header("Flock Settings")]
[Tooltip("Prefab of the hotdog to spawn.")]
public GameObject hotdogPrefab;
[Tooltip("Minimum number of hotdogs in a flock.")]
public int minFlockSize = 3;
[Tooltip("Maximum number of hotdogs in a flock.")]
public int maxFlockSize = 8;
[Tooltip("Spawn radius for flock members.")]
public float flockRadius = 2f;
[Tooltip("Minimum flying height (Y axis).")]
public float minFlyHeight = 15f;
[Tooltip("Maximum flying height (Y axis).")]
public float maxFlyHeight = 25f;
[Tooltip("If true, this object is a flock spawner.")]
public bool isSpawner = true;
[Tooltip("Delay before spawning the rest of the flock (seconds).")]
public float flockSpawnDelay = 1f;
private Rigidbody rb;
private Vector3 flyDirection;
private Vector3 targetDirection;
private float currentFlySpeed;
private float velocityLerp = 0f;
private float targetFlyHeight;
private bool isFlying = false;
private void Start()
{
//IL_00e7: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
rb = ((Component)this).GetComponent<Rigidbody>();
if ((Object)(object)rb == (Object)null)
{
rb = ((Component)this).gameObject.AddComponent<Rigidbody>();
}
rb.useGravity = false;
rb.isKinematic = true;
rb.collisionDetectionMode = (CollisionDetectionMode)2;
rb.interpolation = (RigidbodyInterpolation)1;
rb.WakeUp();
if (isSpawner && (Object)(object)hotdogPrefab != (Object)null)
{
((MonoBehaviour)this).StartCoroutine(SpawnFlockWithDelay());
return;
}
currentFlySpeed = minFlySpeed;
if (Mathf.Approximately(targetFlyHeight, 0f))
{
targetFlyHeight = GetCeilingHeight(((Component)this).transform.position, minFlyHeight, maxFlyHeight);
}
SetInitialDirection();
flyDirection = targetDirection;
((MonoBehaviour)this).StartCoroutine(FlyRoutine());
}
private IEnumerator SpawnFlockWithDelay()
{
yield return (object)new WaitForSeconds(flockSpawnDelay);
int flockCount = Random.Range(minFlockSize, maxFlockSize + 1);
for (int i = 0; i < flockCount; i++)
{
Vector3 val = Random.insideUnitSphere * flockRadius;
Vector3 val2 = ((Component)this).transform.position + val;
GameObject val3 = Object.Instantiate<GameObject>(hotdogPrefab, val2, Quaternion.identity);
val3.SetActive(true);
FlyingHotdog component = val3.GetComponent<FlyingHotdog>();
if ((Object)(object)component != (Object)null)
{
component.isSpawner = false;
component.targetFlyHeight = GetCeilingHeight(val2, minFlyHeight, maxFlyHeight);
}
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
private IEnumerator FlyRoutine()
{
yield return (object)new WaitForSeconds(waitTime);
while (Mathf.Abs(((Component)this).transform.position.y - targetFlyHeight) > 0.1f)
{
yield return (object)new WaitForFixedUpdate();
float dt = Time.fixedDeltaTime;
Vector3 pos = ((Component)this).transform.position;
float ascendSpeed = Mathf.Lerp(minFlySpeed, maxFlySpeed, 0.5f);
float nextY = Mathf.MoveTowards(pos.y, targetFlyHeight, ascendSpeed * dt);
Vector3 nextPos = new Vector3(pos.x, nextY, pos.z);
rb.MovePosition(nextPos);
}
isFlying = true;
((MonoBehaviour)this).StartCoroutine(FlockFlyRoutine());
}
private IEnumerator FlockFlyRoutine()
{
RaycastHit hit = default(RaycastHit);
while (true)
{
SetTargetDirection();
float targetSpeed = Random.Range(minFlySpeed, maxFlySpeed);
float timer = 0f;
float dt;
for (velocityLerp = 0f; timer < directionChangeInterval; timer += dt)
{
yield return (object)new WaitForFixedUpdate();
dt = Time.fixedDeltaTime;
velocityLerp += dt / directionChangeInterval;
currentFlySpeed = Mathf.Lerp(currentFlySpeed, targetSpeed, velocityLerp);
FlyingHotdog flyingHotdog = this;
Vector3 val = Vector3.Slerp(flyDirection, targetDirection, dt * turnSpeed);
flyingHotdog.flyDirection = ((Vector3)(ref val)).normalized;
Vector3 move = flyDirection * currentFlySpeed * dt;
Vector3 nextPos = ((Component)this).transform.position + move;
nextPos.y = Mathf.Clamp(nextPos.y, minFlyHeight, maxFlyHeight);
if (Physics.Raycast(((Component)this).transform.position, flyDirection, ref hit, ((Vector3)(ref move)).magnitude + 0.5f))
{
FlyingHotdog flyingHotdog2 = this;
Vector3 val2 = Vector3.Reflect(flyDirection, ((RaycastHit)(ref hit)).normal);
flyingHotdog2.flyDirection = ((Vector3)(ref val2)).normalized;
targetDirection = flyDirection;
}
rb.MovePosition(nextPos);
}
}
}
private void SetInitialDirection()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: 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_0018: 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)
Vector2 insideUnitCircle = Random.insideUnitCircle;
Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * 0.5f;
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(val.x, 0f, val.y);
targetDirection = ((Vector3)(ref val2)).normalized;
}
private void SetTargetDirection()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0028: 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_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_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)
Vector2 insideUnitCircle = Random.insideUnitCircle;
Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized;
float num = Random.Range(0f - verticalVariance, verticalVariance);
float num2 = Mathf.Clamp(((Component)this).transform.position.y + num, minFlyHeight, maxFlyHeight) - ((Component)this).transform.position.y;
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(normalized.x, num2, normalized.y);
targetDirection = ((Vector3)(ref val)).normalized;
}
private float GetCeilingHeight(Vector3 pos, float min, float max)
{
//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_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_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(pos + Vector3.up * 2f, Vector3.up, ref val, max - min + 2f))
{
return Mathf.Clamp(((RaycastHit)(ref val)).point.y - 1f, min, max);
}
return Random.Range(min, max);
}
}
[ExecuteInEditMode]
public class HolographicSight : MonoBehaviour
{
public Transform VirtualQuad;
public float Scale = 1f;
public bool SizeCompensation = true;
private MaterialPropertyBlock m_block;
private void OnEnable()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
m_block = new MaterialPropertyBlock();
((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
}
private void OnWillRenderObject()
{
//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_0028: 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)
Vector3 val = ((Component)this).transform.InverseTransformPoint(((Component)VirtualQuad).transform.position);
m_block.SetVector("_Offset", Vector4.op_Implicit(val));
m_block.SetFloat("_Scale", Scale);
m_block.SetFloat("_SizeCompensation", (!SizeCompensation) ? 0f : 1f);
((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
}
}
public class ClosedBoltMagRelease : FVRInteractiveObject
{
public ClosedBoltWeapon Weapon;
protected void Awake()
{
((FVRInteractiveObject)this).Awake();
}
public override void SimpleInteraction(FVRViveHand hand)
{
if ((Object)(object)Weapon != (Object)null && ((Object)(object)((FVRInteractiveObject)Weapon).m_hand == (Object)null || (Object)(object)hand != (Object)(object)((FVRInteractiveObject)Weapon).m_hand))
{
((FVRFireArm)Weapon).EjectMag(false);
}
((FVRInteractiveObject)this).SimpleInteraction(hand);
}
}
public class GiantSlingshot : FVRFireArm
{
[Header("Slingshot")]
public Transform Basket;
public Transform String_Left;
public Transform String_Right;
public Transform Centroid;
public Transform String_LeftTarget;
public Transform String_RightTarget;
public GameObject ColGO_Upper;
public GameObject ColGO_Basket;
public Collider Col_Basket;
[Header("Mounting")]
public Collider Col;
public LayerMask LM_CTest;
public float MountRaycastDistance = 0.2f;
[Header("Audio")]
public AudioEvent AudEvent_Mount;
public AudioEvent AudEvent_Fire;
[Header("Slingshot Settings")]
public float maxSlingVel = 20f;
public float maxSlingDistance = 0.5f;
private FVRPhysicalObject m_slungObject;
private Vector3 m_basketLocalOffset = Vector3.zero;
private bool isSlungObjectBeingSlinged;
private Vector3 m_basketWorldVel = Vector3.zero;
private bool m_isCol;
private float m_colChange;
private RaycastHit m_hit;
public override void OnCollisionEnter(Collision collision)
{
//IL_00b9: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: 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)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: 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_00f1: 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_00f9: 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)
((FVRPhysicalObject)this).OnCollisionEnter(collision);
if ((Object)(object)m_slungObject != (Object)null)
{
return;
}
if ((Object)(object)((ContactPoint)(ref collision.contacts[0])).thisCollider == (Object)(object)Col_Basket && (Object)(object)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody != (Object)null && (Object)(object)((Component)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody).gameObject.GetComponent<FVRPhysicalObject>() != (Object)null)
{
FVRPhysicalObject component = ((Component)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody).gameObject.GetComponent<FVRPhysicalObject>();
Vector3 val = Basket.InverseTransformPoint(((Component)component).transform.position);
if (((FVRInteractiveObject)component).IsHeld && !component.RootRigidbody.isKinematic)
{
if (!(val.z > 0f))
{
Vector3 relativeVelocity = collision.relativeVelocity;
if (!(Vector3.Angle(((Vector3)(ref relativeVelocity)).normalized, -((Component)this).transform.forward) < 45f))
{
goto IL_0173;
}
}
m_slungObject = component;
m_basketLocalOffset = ((Component)component).transform.InverseTransformPoint(Basket.position);
ColGO_Upper.SetActive(false);
ColGO_Basket.SetActive(false);
SM.PlayCoreSound((FVRPooledAudioType)0, AudEvent_Mount, Basket.position);
}
}
goto IL_0173;
IL_0173:
if (CanMakeColChange() && !m_isCol && ((FVRInteractiveObject)this).IsHeld)
{
Vector3 relativeVelocity2 = collision.relativeVelocity;
if (((Vector3)(ref relativeVelocity2)).magnitude > 1f && (Object)(object)((ContactPoint)(ref collision.contacts[0])).thisCollider == (Object)(object)Col && ((Object)(object)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody == (Object)null || ((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody.isKinematic))
{
ColOn();
}
}
}
public override void FVRFixedUpdate()
{
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: 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_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: 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_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: 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_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: 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_012b: 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_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: 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)
//IL_01f7: 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_00ae: 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_00c1: 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_00d6: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)m_slungObject != (Object)null && ((Object)(object)m_slungObject.RootRigidbody == (Object)null || !((Component)m_slungObject).gameObject.activeSelf || (Object)(object)m_slungObject.QuickbeltSlot != (Object)null))
{
m_slungObject = null;
}
if ((Object)(object)m_slungObject == (Object)null)
{
isSlungObjectBeingSlinged = false;
}
else if (!isSlungObjectBeingSlinged)
{
if (((FVRInteractiveObject)m_slungObject).IsHeld)
{
Vector3 position = ((Component)m_slungObject).transform.TransformPoint(m_basketLocalOffset);
Basket.position = position;
Vector3 val = Centroid.position - Basket.position;
if (((Vector3)(ref val)).magnitude > 0.001f)
{
Basket.rotation = Quaternion.LookRotation(val, ((Component)this).transform.up);
}
SyncBasketCollider();
}
else
{
isSlungObjectBeingSlinged = true;
Vector3 val2 = Centroid.position - Basket.position;
float magnitude = ((Vector3)(ref val2)).magnitude;
float num = Mathf.Clamp(magnitude / maxSlingDistance, 0f, 1f);
float num2 = Mathf.Lerp(0.1f, maxSlingVel, num);
m_slungObject.RootRigidbody.velocity = ((Vector3)(ref val2)).normalized * num2;
m_slungObject.RootRigidbody.angularVelocity = Vector3.zero;
float num3 = 0.1f + 0.3f * num;
float num4 = Random.Range(0.7f, 0.75f) + num * 0.4f;
SM.PlayCoreSoundOverrides((FVRPooledAudioType)0, AudEvent_Fire, Basket.position, new Vector2(num3, num3), new Vector2(num4, num4));
m_basketWorldVel = Vector3.zero;
}
}
else
{
Centroid.rotation = Quaternion.LookRotation(m_slungObject.RootRigidbody.velocity);
if (Centroid.InverseTransformPoint(((Component)m_slungObject).transform.position).z >= 0.3f)
{
isSlungObjectBeingSlinged = false;
m_slungObject = null;
ColGO_Upper.SetActive(true);
ColGO_Basket.SetActive(true);
Basket.position = Centroid.position;
Basket.rotation = Quaternion.LookRotation(((Component)this).transform.forward, ((Component)this).transform.up);
SyncBasketCollider();
}
else
{
Vector3 position2 = ((Component)m_slungObject).transform.TransformPoint(m_basketLocalOffset);
Basket.position = position2;
Transform basket = Basket;
Vector3 velocity = m_slungObject.RootRigidbody.velocity;
basket.rotation = Quaternion.LookRotation(((Vector3)(ref velocity)).normalized, ((Component)this).transform.up);
SyncBasketCollider();
}
}
UpdateStrings();
if (m_colChange > 0f)
{
m_colChange -= Time.fixedDeltaTime;
}
((FVRFireArm)this).FVRFixedUpdate();
}
public override void UpdateInteraction(FVRViveHand hand)
{
((FVRPhysicalObject)this).UpdateInteraction(hand);
if ((hand.Input.VelLinearWorld.y > 0.5f || hand.Input.TriggerPressed) && m_isCol && CanMakeColChange())
{
ColOff();
}
}
private void UpdateStrings()
{
//IL_00a8: 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_00b8: 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_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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: 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_00fc: 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_0127: 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_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: 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_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_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_018a: 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_0195: 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)
if (!((Object)(object)String_Left == (Object)null) && !((Object)(object)String_Right == (Object)null) && !((Object)(object)String_LeftTarget == (Object)null) && !((Object)(object)String_RightTarget == (Object)null))
{
if (!((Component)String_Left).gameObject.activeSelf)
{
((Component)String_Left).gameObject.SetActive(true);
}
if (!((Component)String_Right).gameObject.activeSelf)
{
((Component)String_Right).gameObject.SetActive(true);
}
float num = 15f * Time.deltaTime;
Vector3 val = String_LeftTarget.position - String_Left.position;
float num2 = Mathf.Lerp(String_Left.localScale.z, ((Vector3)(ref val)).magnitude, num);
String_Left.rotation = Quaternion.Slerp(String_Left.rotation, Quaternion.LookRotation(val, ((Component)this).transform.up), num);
String_Left.localScale = new Vector3(1f, 1f, Mathf.Max(0.01f, num2));
Vector3 val2 = String_RightTarget.position - String_Right.position;
float num3 = Mathf.Lerp(String_Right.localScale.z, ((Vector3)(ref val2)).magnitude, num);
String_Right.rotation = Quaternion.Slerp(String_Right.rotation, Quaternion.LookRotation(val2, ((Component)this).transform.up), num);
String_Right.localScale = new Vector3(1f, 1f, Mathf.Max(0.01f, num3));
}
}
private void SyncBasketCollider()
{
//IL_0024: 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)
if ((Object)(object)Col_Basket != (Object)null)
{
((Component)Col_Basket).transform.position = Basket.position;
((Component)Col_Basket).transform.rotation = Basket.rotation;
}
}
private bool CanMakeColChange()
{
return m_colChange <= 0f;
}
private void ColOn()
{
//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_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_0019: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_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_0086: 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_0090: 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_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_00ab: 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_00d5: 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_0100: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = ((Component)this).transform.position;
Quaternion rotation = ((Component)this).transform.rotation;
if (!(Vector3.Angle(Vector3.up, ((Component)this).transform.forward) > 80f) && Physics.Raycast(((Component)this).transform.position, Vector3.down, ref m_hit, MountRaycastDistance, LayerMask.op_Implicit(LM_CTest), (QueryTriggerInteraction)1))
{
position = ((RaycastHit)(ref m_hit)).point + Vector3.up * 0.022f;
rotation = Quaternion.LookRotation(GM.CurrentPlayerBody.Head.position - position, Vector3.up);
m_isCol = true;
Col.enabled = false;
m_colChange = 1f;
((Component)this).transform.position = position;
((Component)this).transform.rotation = rotation;
((FVRPhysicalObject)this).RootRigidbody.isKinematic = true;
SM.PlayImpactSound((ImpactType)160, (MatSoundType)3, (AudioImpactIntensity)2, ((Component)this).transform.position, (FVRPooledAudioType)41, 10f);
}
}
private void ColOff()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
if (m_isCol)
{
m_isCol = false;
m_colChange = 1f;
Col.enabled = true;
((FVRPhysicalObject)this).RootRigidbody.isKinematic = false;
SM.PlayImpactSound((ImpactType)160, (MatSoundType)3, (AudioImpactIntensity)1, ((Component)this).transform.position, (FVRPooledAudioType)41, 10f);
}
}
}
namespace VolksScripts
{
public class HeartbeatSensor : FVRPhysicalObject
{
[Header("Sensor Settings")]
public float[] ScanningRanges = new float[3] { 5f, 10f, 20f };
public int CurrentRangeIndex = 0;
public float BatteryLifeSeconds = 60f;
public float RechargeRate = 10f;
[Header("UI & Audio")]
public RectTransform Screen;
public GameObject PingDotPrefab;
public GameObject WallRectPrefab;
public AudioSource BeepAudio;
public Image BatteryBar;
public Text BatteryText;
[Header("Button Audio")]
public AudioSource ButtonAudioSource;
public AudioClip ButtonPressClip;
[Header("Detection")]
public LayerMask SosigMask;
public LayerMask WallMask;
[Header("Audio Ping")]
public float PingInterval = 1f;
private float _pingTimer = 0f;
[Header("Radar Filtering")]
public float MaxPingHeight = 2f;
[Header("Ping Wave")]
public GameObject PingWavePrefab;
public float PingWaveDuration = 0.8f;
private List<GameObject> _activePingWaves = new List<GameObject>();
[Header("Battery Blink")]
[Range(0f, 1f)]
public float LowBatteryThreshold = 0.25f;
public Color LowBatteryColor = Color.red;
public float BlinkSpeed = 4f;
[Header("Enemy Floor Detection")]
[Tooltip("Max vertical distance to consider an enemy on the same floor.")]
public float SameFloorHeightThreshold = 0.75f;
private Color _batteryTextNormalColor;
private Coroutine _blinkRoutine;
private bool _isBlinking;
private Dictionary<Transform, GameObject> _pings = new Dictionary<Transform, GameObject>();
private Dictionary<Collider, GameObject> _wallRects = new Dictionary<Collider, GameObject>();
private bool _isOn = false;
private float _battery;
private bool _enemyDetected = false;
private bool _enemyOnSameFloor = false;
private Transform _directionReference;
protected void Start()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
//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_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)
_battery = BatteryLifeSeconds;
if ((Object)(object)Screen != (Object)null)
{
((Component)Screen).gameObject.SetActive(_isOn);
}
if ((Object)(object)BatteryText != (Object)null)
{
_batteryTextNormalColor = ((Graphic)BatteryText).color;
}
GameObject val = new GameObject("DirectionReference");
_directionReference = val.transform;
_directionReference.parent = null;
_directionReference.position = Vector3.zero;
_directionReference.rotation = Quaternion.identity;
UpdateUI();
}
private void Update()
{
if ((Object)(object)Screen != (Object)null)
{
((Component)Screen).gameObject.SetActive(_isOn);
}
if (_isOn)
{
_battery -= Time.deltaTime;
if (_battery <= 0f)
{
_battery = 0f;
_isOn = false;
if ((Object)(object)Screen != (Object)null)
{
((Component)Screen).gameObject.SetActive(false);
}
UpdateUI();
return;
}
UpdateScreen();
_pingTimer += Time.deltaTime;
if (_pingTimer >= PingInterval && _enemyOnSameFloor)
{
if (Object.op_Implicit((Object)(object)BeepAudio) && !BeepAudio.mute && (Object)(object)BeepAudio.clip != (Object)null)
{
BeepAudio.PlayOneShot(BeepAudio.clip);
}
SpawnPingWave();
_pingTimer = 0f;
}
}
else
{
if (_battery < BatteryLifeSeconds)
{
_battery += Time.deltaTime * RechargeRate;
}
if (Object.op_Implicit((Object)(object)BeepAudio) && BeepAudio.isPlaying)
{
BeepAudio.Stop();
}
_pingTimer = 0f;
}
UpdateUI();
}
private void UpdateUI()
{
float num = _battery / BatteryLifeSeconds;
if (Object.op_Implicit((Object)(object)BatteryBar))
{
BatteryBar.fillAmount = num;
}
if (Object.op_Implicit((Object)(object)BatteryText))
{
BatteryText.text = Mathf.RoundToInt(num * 100f) + "%";
if (num <= LowBatteryThreshold)
{
StartBlink();
}
else
{
StopBlink();
}
}
}
private void StartBlink()
{
if (!((Object)(object)BatteryText == (Object)null) && !_isBlinking)
{
_isBlinking = true;
_blinkRoutine = ((MonoBehaviour)this).StartCoroutine(BlinkBatteryText());
}
}
private void StopBlink()
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)BatteryText == (Object)null) && _isBlinking)
{
_isBlinking = false;
if (_blinkRoutine != null)
{
((MonoBehaviour)this).StopCoroutine(_blinkRoutine);
}
_blinkRoutine = null;
((Graphic)BatteryText).color = _batteryTextNormalColor;
}
}
private IEnumerator BlinkBatteryText()
{
while (_isBlinking)
{
float t = (Mathf.Sin(Time.time * BlinkSpeed) + 1f) * 0.5f;
((Graphic)BatteryText).color = Color.Lerp(_batteryTextNormalColor, LowBatteryColor, t);
yield return null;
}
}
private void UpdateScreen()
{
//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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_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_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: 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_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: 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_0196: 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_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: 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_036f: Unknown result type (might be due to invalid IL or missing references)
//IL_0374: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
float num = ScanningRanges[CurrentRangeIndex];
float num2 = ((Component)this).transform.position.y;
if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Torso != (Object)null)
{
num2 = GM.CurrentPlayerBody.Torso.position.y + 0.3f;
}
float num3 = num2 - MaxPingHeight * 0.5f;
float num4 = num2 + MaxPingHeight * 0.5f;
Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, num, LayerMask.op_Implicit(SosigMask));
HashSet<Transform> hashSet = new HashSet<Transform>();
_enemyOnSameFloor = false;
Vector2 anchoredPosition = default(Vector2);
for (int i = 0; i < array.Length; i++)
{
Transform transform = ((Component)array[i]).transform;
float y = transform.position.y;
if ((Object)(object)((Component)transform).GetComponentInParent<FVRPlayerBody>() != (Object)null)
{
continue;
}
FVRPlayerHitbox componentInParent = ((Component)transform).GetComponentInParent<FVRPlayerHitbox>();
if ((!((Object)(object)componentInParent != (Object)null) || !((Object)(object)componentInParent.Body != (Object)null)) && !(y < num3) && !(y > num4))
{
hashSet.Add(transform);
if (!_pings.ContainsKey(transform))
{
GameObject value = Object.Instantiate<GameObject>(PingDotPrefab, (Transform)(object)Screen);
_pings[transform] = value;
}
Vector3 val = _directionReference.InverseTransformPoint(transform.position - ((Component)this).transform.position);
Rect rect = Screen.rect;
float num5 = ((Rect)(ref rect)).width / 2f;
Rect rect2 = Screen.rect;
float num6 = ((Rect)(ref rect2)).height / 2f;
float num7 = Mathf.Max(num5, num6);
anchoredPosition.x = val.x / num * num7;
anchoredPosition.y = val.z / num * num7;
if (Mathf.Abs(anchoredPosition.x) > num5 || Mathf.Abs(anchoredPosition.y) > num6)
{
_pings[transform].SetActive(false);
}
else
{
_pings[transform].SetActive(true);
}
_pings[transform].GetComponent<RectTransform>().anchoredPosition = anchoredPosition;
if (Mathf.Abs(y - num2) <= SameFloorHeightThreshold)
{
_enemyOnSameFloor = true;
}
}
}
List<Transform> list = new List<Transform>(_pings.Keys);
for (int j = 0; j < list.Count; j++)
{
if (!hashSet.Contains(list[j]))
{
Object.Destroy((Object)(object)_pings[list[j]]);
_pings.Remove(list[j]);
}
}
_enemyDetected = hashSet.Count > 0;
Collider[] array2 = Physics.OverlapSphere(((Component)this).transform.position, num, LayerMask.op_Implicit(WallMask));
HashSet<Collider> hashSet2 = new HashSet<Collider>();
foreach (Collider val2 in array2)
{
if (IsLikelyWall(val2))
{
Bounds bounds = val2.bounds;
float y2 = ((Bounds)(ref bounds)).min.y;
Bounds bounds2 = val2.bounds;
float y3 = ((Bounds)(ref bounds2)).max.y;
if (!(y3 < num3) && !(y2 > num4))
{
hashSet2.Add(val2);
DrawWallOnScreenRadar_TopDown(val2, num);
}
}
}
List<Collider> list2 = new List<Collider>(_wallRects.Keys);
for (int l = 0; l < list2.Count; l++)
{
if (!hashSet2.Contains(list2[l]))
{
Object.Destroy((Object)(object)_wallRects[list2[l]]);
_wallRects.Remove(list2[l]);
}
}
}
private bool IsLikelyWall(Collider wall)
{
//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_000a: 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)
Bounds bounds = wall.bounds;
return ((Bounds)(ref bounds)).size.y >= 1.5f;
}
private Vector2 ProjectToRadar(Vector3 worldPos, float range)
{
//IL_0007: 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_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_001d: 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_0029: 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_0082: 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_008b: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = _directionReference.InverseTransformPoint(worldPos - ((Component)this).transform.position);
Rect rect = Screen.rect;
float num = ((Rect)(ref rect)).width / 2f;
Rect rect2 = Screen.rect;
float num2 = ((Rect)(ref rect2)).height / 2f;
float num3 = Mathf.Max(num, num2);
Vector2 result = default(Vector2);
result.x = val.x / range * num3;
result.y = val.z / range * num3;
return result;
}
private void DrawWallOnScreenRadar_TopDown(Collider wall, float range)
{
//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_000a: 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_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_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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//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_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_011a: 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_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: 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_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: 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_01fb: 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_01ff: 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_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: 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_023e: 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_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: 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_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: 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_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_0374: Unknown result type (might be due to invalid IL or missing references)
Bounds bounds = wall.bounds;
Vector3 center = ((Bounds)(ref bounds)).center;
Vector3 extents = ((Bounds)(ref bounds)).extents;
Vector3[] array = (Vector3[])(object)new Vector3[8]
{
new Vector3(center.x + extents.x, center.y, center.z + extents.z),
new Vector3(center.x + extents.x, center.y, center.z - extents.z),
new Vector3(center.x - extents.x, center.y, center.z + extents.z),
new Vector3(center.x - extents.x, center.y, center.z - extents.z),
new Vector3(center.x + extents.x, center.y, center.z),
new Vector3(center.x - extents.x, center.y, center.z),
new Vector3(center.x, center.y, center.z + extents.z),
new Vector3(center.x, center.y, center.z - extents.z)
};
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(float.MaxValue, float.MaxValue);
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(float.MinValue, float.MinValue);
for (int i = 0; i < array.Length; i++)
{
Vector2 val3 = ProjectToRadar(array[i], range);
val = Vector2.Min(val, val3);
val2 = Vector2.Max(val2, val3);
}
Rect rect = Screen.rect;
float num = ((Rect)(ref rect)).width / 2f;
Rect rect2 = Screen.rect;
float num2 = ((Rect)(ref rect2)).height / 2f;
val.x = Mathf.Clamp(val.x, 0f - num, num);
val.y = Mathf.Clamp(val.y, 0f - num2, num2);
val2.x = Mathf.Clamp(val2.x, 0f - num, num);
val2.y = Mathf.Clamp(val2.y, 0f - num2, num2);
float num3 = Mathf.Abs(val2.x - val.x);
Rect rect3 = Screen.rect;
float num4 = Mathf.Min(num3, ((Rect)(ref rect3)).width);
float num5 = Mathf.Abs(val2.y - val.y);
Rect rect4 = Screen.rect;
float num6 = Mathf.Min(num5, ((Rect)(ref rect4)).height);
if (!_wallRects.TryGetValue(wall, out var value))
{
value = Object.Instantiate<GameObject>(WallRectPrefab, (Transform)(object)Screen);
_wallRects[wall] = value;
}
value.SetActive(true);
RectTransform component = value.GetComponent<RectTransform>();
component.anchoredPosition = (val + val2) * 0.5f;
component.sizeDelta = new Vector2(num4, num6);
}
private void SpawnPingWave()
{
//IL_003a: 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)
if (Object.op_Implicit((Object)(object)PingWavePrefab) && Object.op_Implicit((Object)(object)Screen))
{
GameObject val = Object.Instantiate<GameObject>(PingWavePrefab, (Transform)(object)Screen);
val.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
((Transform)val.GetComponent<RectTransform>()).localScale = Vector3.one;
_activePingWaves.Add(val);
((MonoBehaviour)this).StartCoroutine(AnimatePingWave(val));
}
}
private IEnumerator AnimatePingWave(GameObject wave)
{
RectTransform rt = wave.GetComponent<RectTransform>();
Image img = wave.GetComponent<Image>();
float t = 0f;
Color startColor = ((Graphic)img).color;
while (t < PingWaveDuration)
{
float norm = t / PingWaveDuration;
((Transform)rt).localScale = Vector3.one * Mathf.Lerp(0.2f, 1.2f, norm);
((Graphic)img).color = new Color(startColor.r, startColor.g, startColor.b, Mathf.Lerp(0.5f, 0f, norm));
t += Time.deltaTime;
yield return null;
}
_activePingWaves.Remove(wave);
Object.Destroy((Object)(object)wave);
}
public void ToggleAudio()
{
if (Object.op_Implicit((Object)(object)BeepAudio))
{
BeepAudio.mute = !BeepAudio.mute;
}
PlayButtonSound();
}
public void IncreaseRange()
{
if (CurrentRangeIndex < ScanningRanges.Length - 1)
{
CurrentRangeIndex++;
}
PlayButtonSound();
}
public void DecreaseRange()
{
if (CurrentRangeIndex > 0)
{
CurrentRangeIndex--;
}
PlayButtonSound();
}
public void TogglePower()
{
_isOn = !_isOn && _battery > 0f;
if ((Object)(object)Screen != (Object)null)
{
((Component)Screen).gameObject.SetActive(_isOn);
}
UpdateUI();
PlayButtonSound();
}
private void PlayButtonSound()
{
if (Object.op_Implicit((Object)(object)ButtonAudioSource) && Object.op_Implicit((Object)(object)ButtonPressClip))
{
ButtonAudioSource.PlayOneShot(ButtonPressClip);
}
}
}
public class HeartbeatSensorButton : FVRInteractiveObject
{
public enum ButtonType
{
Power,
Audio,
RangePlus,
RangeMinus
}
[Header("Button Settings")]
public HeartbeatSensor TargetSensor;
public ButtonType Type;
public AudioSource ButtonAudioSource;
public AudioClip ButtonPressClip;
private bool m_isToggled = false;
public bool IsToggled => m_isToggled;
protected void Awake()
{
((FVRInteractiveObject)this).Awake();
}
public override void SimpleInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).SimpleInteraction(hand);
TriggerAction();
}
private void TriggerAction()
{
if (!((Object)(object)TargetSensor == (Object)null))
{
switch (Type)
{
case ButtonType.Power:
m_isToggled = !m_isToggled;
TargetSensor.TogglePower();
break;
case ButtonType.Audio:
m_isToggled = !m_isToggled;
TargetSensor.ToggleAudio();
break;
case ButtonType.RangePlus:
TargetSensor.IncreaseRange();
break;
case ButtonType.RangeMinus:
TargetSensor.DecreaseRange();
break;
}
if (Object.op_Implicit((Object)(object)ButtonAudioSource) && Object.op_Implicit((Object)(object)ButtonPressClip))
{
ButtonAudioSource.PlayOneShot(ButtonPressClip);
}
}
}
}
}
public class GrillButton : FVRInteractiveObject
{
public KebabGrill grill;
public override void SimpleInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).SimpleInteraction(hand);
if ((Object)(object)grill != (Object)null)
{
grill.ToggleGrill();
}
}
}
[RequireComponent(typeof(Collider))]
public class KebabGrill : FVRInteractiveObject
{
[Header("Spawner params")]
public string itemID;
public bool isInfinite = true;
[Tooltip("How many objects can be taken from this spawner before it runs out")]
public int objectCapacity;
private int objectsRemaining;
private AnvilCallback<GameObject> itemLoader;
[Header("Audio")]
public AudioSource audioSource;
public AudioClip emptyClip;
public AudioClip grillOnClip;
public AudioClip grillOffClip;
public AudioSource grillLoopSource;
public AudioClip grillLoopClip;
[Header("Scaling")]
public Transform visualToScale;
public Vector3 fullScale = Vector3.one;
public Vector3 emptyScale = new Vector3(0.2f, 0.2f, 0.2f);
[Header("Regeneration")]
public bool enableRegeneration = false;
public float regenTime = 10f;
[Header("Grill Visuals")]
public Renderer grillRenderer;
public Material grillOnMaterial;
public Material grillOffMaterial;
[Header("Rotating Object")]
public GameObject spinnyThing;
public float spinRate = 180f;
public int spinAxis = 1;
[Header("Grill Toggle Object")]
public GameObject grillToggleObject;
[Header("Button Animation")]
public Transform buttonTransform;
public bool animateButtonTranslation = true;
public Vector3 buttonOnPosition;
public Vector3 buttonOffPosition;
public Vector3 buttonOnRotation;
public Vector3 buttonOffRotation;
public float buttonAnimSpeed = 8f;
private Coroutine regenCoroutine;
private bool grillOn = false;
private float buttonAnimLerp = 0f;
private float buttonAnimTarget = 0f;
public override void Awake()
{
//IL_0046: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).Awake();
itemLoader = ((AnvilAsset)IM.OD[itemID]).GetGameObjectAsync();
objectsRemaining = objectCapacity;
if ((Object)(object)visualToScale != (Object)null)
{
visualToScale.localScale = fullScale;
}
SetGrillMaterial(on: false);
if ((Object)(object)grillToggleObject != (Object)null)
{
grillToggleObject.SetActive(false);
}
if ((Object)(object)grillLoopSource != (Object)null)
{
grillLoopSource.loop = true;
grillLoopSource.clip = grillLoopClip;
grillLoopSource.Stop();
}
if ((Object)(object)buttonTransform != (Object)null)
{
buttonTransform.localPosition = buttonOffPosition;
buttonTransform.localEulerAngles = buttonOffRotation;
}
}
public override void BeginInteraction(FVRViveHand hand)
{
//IL_0050: 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)
if (!isInfinite && objectsRemaining < 1)
{
return;
}
((FVRInteractiveObject)this).BeginInteraction(hand);
if (!((AnvilCallbackBase)itemLoader).IsCompleted)
{
((AnvilCallbackBase)itemLoader).CompleteNow();
}
FVRPhysicalObject component = Object.Instantiate<GameObject>(itemLoader.Result, ((Component)hand).transform.position, ((Component)hand).transform.rotation).GetComponent<FVRPhysicalObject>();
if ((Object)(object)component != (Object)null)
{
hand.ForceSetInteractable((FVRInteractiveObject)(object)component);
((FVRInteractiveObject)component).BeginInteraction(hand);
}
objectsRemaining--