using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using Atlas;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using Sodalite;
using Sodalite.Api;
using UnityEngine;
using UnityEngine.SceneManagement;
[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 JerryAr.SpaceAnchor
{
[BepInPlugin("JerryAr.SpaceAnchor", "SpaceAnchor", "0.1.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("nrgill28.Atlas", "1.0.1")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class SpaceAnchorPlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "JerryAr.SpaceAnchor");
AtlasPlugin.RegisterScene(Path.Combine(BasePath, "greenscreenspace"));
OtherLoader.RegisterDirectLoad(BasePath, "JerryAr.SpaceAnchor", "", "", "spaceanchor", "");
}
}
}
public class SnapToPoint : MonoBehaviour
{
public GameObject Obj;
public GameObject Targ;
private void Start()
{
}
private void Update()
{
//IL_0017: 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)
Obj.transform.position = Targ.transform.position;
Obj.transform.rotation = Targ.transform.rotation;
}
}
namespace JerrySpaceAnchor
{
public class FlagPostGreen : MonoBehaviour
{
public FlagPostGreen OtherAnchor;
public float cd = 0.25f;
public bool isRoot;
private void FixedUpdate()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
if (isRoot)
{
((Component)this).gameObject.transform.eulerAngles = new Vector3(0f, 0f, 0f);
}
if (!isRoot)
{
((Component)this).gameObject.transform.eulerAngles = new Vector3(0f, 90f, 0f);
}
if (cd > 0f)
{
cd -= Time.deltaTime;
}
if (!(cd <= 0f))
{
return;
}
cd = 0f;
if ((Object)(object)OtherAnchor == (Object)null)
{
FlagPostGreen[] array = Object.FindObjectsOfType<FlagPostGreen>();
if (array.Length > 0)
{
for (int i = 0; i < array.Length; i++)
{
if ((Object)(object)array[i] != (Object)(object)this)
{
OtherAnchor = array[i];
}
}
}
}
if ((Object)(object)OtherAnchor != (Object)null)
{
((Component)this).gameObject.transform.position = ((Component)OtherAnchor).gameObject.transform.position;
Object.Destroy((Object)(object)((Component)this).gameObject);
}
isRoot = true;
}
private void OnDisable()
{
isRoot = false;
cd = 0.25f;
}
}
[BepInPlugin("JerryDLL.JerrySpaceAnchor", "JSA", "1.0.0")]
[BepInDependency("nrgill28.Sodalite", "1.4.1")]
[BepInProcess("h3vr.exe")]
public class FlagPostPlugin : BaseUnityPlugin
{
public GameObject FlagPostPreView;
public GameObject FlagPostRed;
public GameObject FlagPostGreen;
public GameObject FlagPostRedTemp;
public GameObject FlagPostGreenTemp;
public GameObject Anchor;
public GameObject AnchorGM;
public float triggercd = 1f;
public bool shouldsetred;
public bool isLeft;
public bool isRight;
public bool isTriggerHeld;
public static bool SpawnFlagPosts = false;
public Vector3 pos;
public Vector3 rot;
public LayerMask lm;
public bool TransformAccuired;
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogMessage((object)"New harmony");
Logger.LogMessage((object)"Setted the fields");
Harmony.CreateAndPatchAll(typeof(FlagPostPlugin), (string)null);
Logger.LogMessage((object)"Loaded sf System");
}
[HarmonyPatch(typeof(FVRWristMenu2), "Awake")]
[HarmonyPostfix]
public static void SFWMAH(FVRWristMenu2 __instance)
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
if ((Object)(object)__instance == (Object)null)
{
Logger.LogMessage((object)"No FVRWristMenu2");
}
bool flag = false;
string text = "SetSpaceAnchor?";
foreach (WristMenuButton button in WristMenuAPI.Buttons)
{
Logger.LogMessage((object)("CC " + button.Text));
if (button.Text == text)
{
flag = true;
break;
}
}
if (!flag)
{
WristMenuAPI.Buttons.Add(new WristMenuButton(text, new ButtonClickEvent(SpawnSAFP)));
}
}
private static void SpawnSAFP(object sender, ButtonClickEventArgs args)
{
//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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "GreenScreenSpace")
{
SpawnFlagPosts = !SpawnFlagPosts;
}
Scene activeScene2 = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene2)).name != "GreenScreenSpace")
{
SpawnFlagPosts = false;
}
}
public void FixedUpdate()
{
//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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
lm = LayerMask.op_Implicit(268435456);
if (!SpawnFlagPosts)
{
return;
}
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "GreenScreenSpace")
{
if ((Object)(object)FlagPostRedTemp == (Object)null && (Object)(object)Object.FindObjectOfType<FlagPostRed>() != (Object)null)
{
FlagPostRedTemp = ((Component)Object.FindObjectOfType<FlagPostRed>()).gameObject;
}
if ((Object)(object)FlagPostGreenTemp == (Object)null && (Object)(object)Object.FindObjectOfType<FlagPostGreen>() != (Object)null)
{
FlagPostGreenTemp = ((Component)Object.FindObjectOfType<FlagPostGreen>()).gameObject;
}
}
}
private void AxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
{
//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_0008: 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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
Quaternion rotation = tr_self.rotation;
Vector3 val = lookPos - tr_self.position;
Vector3 val2 = tr_self.rotation * directionAxis;
Vector3 val3 = Vector3.Cross(val2, val);
Vector3 normalized = ((Vector3)(ref val3)).normalized;
float num = Vector3.Angle(val2, val);
tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
tr_self.localEulerAngles = new Vector3(0f, tr_self.localEulerAngles.y, 0f);
}
public void Update()
{
//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_0b91: Unknown result type (might be due to invalid IL or missing references)
//IL_0b96: Unknown result type (might be due to invalid IL or missing references)
//IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
//IL_0acc: Unknown result type (might be due to invalid IL or missing references)
//IL_0ad2: Unknown result type (might be due to invalid IL or missing references)
//IL_0ad7: Unknown result type (might be due to invalid IL or missing references)
//IL_0c19: Unknown result type (might be due to invalid IL or missing references)
//IL_0c1e: Unknown result type (might be due to invalid IL or missing references)
//IL_0c24: Unknown result type (might be due to invalid IL or missing references)
//IL_0c29: 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_0343: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_0473: Unknown result type (might be due to invalid IL or missing references)
//IL_0487: Unknown result type (might be due to invalid IL or missing references)
//IL_048c: Unknown result type (might be due to invalid IL or missing references)
//IL_04a5: 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_05dd: Unknown result type (might be due to invalid IL or missing references)
//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0600: Unknown result type (might be due to invalid IL or missing references)
//IL_0614: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_0632: Unknown result type (might be due to invalid IL or missing references)
//IL_051f: Unknown result type (might be due to invalid IL or missing references)
//IL_0533: Unknown result type (might be due to invalid IL or missing references)
//IL_053d: Unknown result type (might be due to invalid IL or missing references)
//IL_0542: Unknown result type (might be due to invalid IL or missing references)
//IL_0556: Unknown result type (might be due to invalid IL or missing references)
//IL_055b: Unknown result type (might be due to invalid IL or missing references)
//IL_0574: 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_00d3: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0707: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0876: Unknown result type (might be due to invalid IL or missing references)
//IL_0891: Unknown result type (might be due to invalid IL or missing references)
//IL_0896: Unknown result type (might be due to invalid IL or missing references)
//IL_08a3: Unknown result type (might be due to invalid IL or missing references)
//IL_09ac: Unknown result type (might be due to invalid IL or missing references)
//IL_09c7: Unknown result type (might be due to invalid IL or missing references)
//IL_09cc: Unknown result type (might be due to invalid IL or missing references)
//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
//IL_08f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0a08: Unknown result type (might be due to invalid IL or missing references)
//IL_0a2c: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "GreenScreenSpace")
{
GM.CurrentSceneSettings.IsSceneSavingEnabled = true;
if ((Object)(object)FlagPostRedTemp != (Object)null && (Object)(object)FlagPostGreenTemp != (Object)null)
{
if (FlagPostRedTemp.activeInHierarchy && FlagPostGreenTemp.activeInHierarchy && FlagPostRedTemp.transform.eulerAngles.y == 0f && FlagPostGreenTemp.transform.eulerAngles.y == 0f)
{
if ((Object)(object)Anchor == (Object)null)
{
Anchor = new GameObject("SpaceAnchor");
}
if ((Object)(object)AnchorGM == (Object)null)
{
AnchorGM = new GameObject("SpaceAnchorGM");
}
if ((Object)(object)Anchor != (Object)null)
{
Anchor.transform.position = (FlagPostRedTemp.transform.position + FlagPostGreenTemp.transform.position) / 2f;
AxisLookAt(Anchor.transform, FlagPostRedTemp.transform.position, Vector3.forward);
if ((Object)(object)AnchorGM != (Object)null)
{
if (!TransformAccuired)
{
AnchorGM.transform.position = ((Component)GM.CurrentMovementManager).gameObject.transform.position;
AnchorGM.transform.eulerAngles = ((Component)GM.CurrentMovementManager).gameObject.transform.eulerAngles;
AnchorGM.transform.SetParent(Anchor.transform);
if ((Object)(object)AnchorGM.transform.parent == (Object)(object)Anchor.transform)
{
pos = AnchorGM.transform.localPosition;
rot = AnchorGM.transform.localEulerAngles;
TransformAccuired = true;
}
}
if (TransformAccuired)
{
AnchorGM.transform.SetParent(Anchor.transform);
AnchorGM.transform.localPosition = new Vector3(pos.x, AnchorGM.transform.localPosition.y, pos.z);
AnchorGM.transform.localEulerAngles = rot;
((Component)GM.CurrentMovementManager).gameObject.transform.position = AnchorGM.transform.position;
((Component)GM.CurrentMovementManager).gameObject.transform.eulerAngles = AnchorGM.transform.eulerAngles;
}
}
}
}
if (!FlagPostRedTemp.activeInHierarchy || !FlagPostGreenTemp.activeInHierarchy || FlagPostRedTemp.transform.eulerAngles.y != 0f || FlagPostGreenTemp.transform.eulerAngles.y != 0f)
{
((Component)GM.CurrentMovementManager).gameObject.transform.SetParent((Transform)null);
}
}
if (SpawnFlagPosts)
{
if ((Object)(object)FlagPostRed == (Object)null && (Object)(object)FlagPostRedTemp != (Object)null)
{
FlagPostRed = FlagPostRedTemp;
}
if ((Object)(object)FlagPostGreen == (Object)null && (Object)(object)FlagPostGreenTemp != (Object)null)
{
FlagPostGreen = FlagPostGreenTemp;
}
if ((Object)(object)FlagPostRed == (Object)null && (Object)(object)FlagPostRedTemp == (Object)null)
{
ItemSpawnerID spawnerID = IM.GetSpawnerID("FlagPostRed");
FVRObject mainObject = spawnerID.MainObject;
FlagPostRed = Object.Instantiate<GameObject>(((AnvilAsset)mainObject).GetGameObject(), ((Component)GM.CurrentMovementManager).gameObject.transform.position + ((Component)GM.CurrentMovementManager).gameObject.transform.forward * 0.5f, new Quaternion(0f, GM.CurrentMovementManager.Head.rotation.y + 180f, 0f, 1f));
FlagPostRed.SetActive(false);
Logger.LogMessage((object)"RedFlag Deployed.");
}
if ((Object)(object)FlagPostGreen == (Object)null && (Object)(object)FlagPostGreenTemp == (Object)null)
{
ItemSpawnerID spawnerID2 = IM.GetSpawnerID("FlagPostGreen");
FVRObject mainObject2 = spawnerID2.MainObject;
FlagPostGreen = Object.Instantiate<GameObject>(((AnvilAsset)mainObject2).GetGameObject(), ((Component)GM.CurrentMovementManager).gameObject.transform.position + ((Component)GM.CurrentMovementManager).gameObject.transform.forward * 0.5f, new Quaternion(0f, GM.CurrentMovementManager.Head.rotation.y + 180f, 0f, 1f));
FlagPostGreen.SetActive(false);
Logger.LogMessage((object)"GreenFlag Deployed.");
}
if ((Object)(object)FlagPostPreView == (Object)null)
{
ItemSpawnerID spawnerID3 = IM.GetSpawnerID("FlagPostPreView");
FVRObject mainObject3 = spawnerID3.MainObject;
FlagPostPreView = Object.Instantiate<GameObject>(((AnvilAsset)mainObject3).GetGameObject(), ((Component)GM.CurrentMovementManager).gameObject.transform.position + ((Component)GM.CurrentMovementManager).gameObject.transform.forward * 0.5f, new Quaternion(0f, GM.CurrentMovementManager.Head.rotation.y + 180f, 0f, 1f));
FlagPostRed.SetActive(false);
Logger.LogMessage((object)"FlagPostPreView Deployed.");
}
if ((Object)(object)FlagPostPreView != (Object)null)
{
if (isTriggerHeld)
{
if (shouldsetred && (Object)(object)FlagPostRed != (Object)null)
{
FlagPostRed.SetActive(false);
FlagPostRed.transform.position = FlagPostPreView.transform.position;
}
if (!shouldsetred && (Object)(object)FlagPostGreen != (Object)null)
{
FlagPostGreen.SetActive(false);
FlagPostGreen.transform.position = FlagPostPreView.transform.position;
}
}
if (!isTriggerHeld)
{
FlagPostPreView.SetActive(false);
if (triggercd <= 0f)
{
if (shouldsetred && (Object)(object)FlagPostRed != (Object)null)
{
FlagPostRed.SetActive(true);
triggercd = 1f;
shouldsetred = false;
}
if (!shouldsetred && (Object)(object)FlagPostGreen != (Object)null)
{
FlagPostGreen.SetActive(true);
triggercd = 1f;
shouldsetred = true;
}
}
}
}
if ((Object)(object)FlagPostPreView != (Object)null)
{
if (GM.CurrentMovementManager.Hands[0].Input.TriggerFloat > 0.75f && !isRight)
{
if (!isLeft)
{
triggercd = 1f;
isLeft = true;
}
if (triggercd > 0f)
{
triggercd -= Time.deltaTime;
}
if (triggercd <= 0f)
{
triggercd = 0f;
isTriggerHeld = true;
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position, -((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.up, ref val, 10f, LayerMask.op_Implicit(lm)))
{
FlagPostPreView.SetActive(true);
FlagPostPreView.transform.position = ((RaycastHit)(ref val)).point;
FlagPostPreView.transform.eulerAngles = new Vector3(0f, 0f, 0f);
}
}
}
if (GM.CurrentMovementManager.Hands[1].Input.TriggerFloat > 0.75f && !isLeft)
{
if (!isRight)
{
triggercd = 1f;
isRight = true;
}
if (triggercd > 0f)
{
triggercd -= Time.deltaTime;
}
if (triggercd <= 0f)
{
triggercd = 0f;
isTriggerHeld = true;
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position, -((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.up, ref val2, 10f, LayerMask.op_Implicit(lm)))
{
FlagPostPreView.SetActive(true);
FlagPostPreView.transform.position = ((RaycastHit)(ref val2)).point;
FlagPostPreView.transform.eulerAngles = new Vector3(0f, 0f, 0f);
}
}
}
if (GM.CurrentMovementManager.Hands[0].Input.TriggerFloat <= 0.75f && isLeft)
{
isTriggerHeld = false;
isLeft = false;
}
if (GM.CurrentMovementManager.Hands[1].Input.TriggerFloat <= 0.75f && isRight)
{
isTriggerHeld = false;
isRight = false;
}
}
}
else if (!SpawnFlagPosts)
{
pos = Vector3.zero;
rot = Vector3.zero;
shouldsetred = false;
if ((Object)(object)FlagPostRed != (Object)null)
{
Object.Destroy((Object)(object)FlagPostRed.gameObject);
}
if ((Object)(object)FlagPostGreen != (Object)null)
{
Object.Destroy((Object)(object)FlagPostGreen.gameObject);
}
if ((Object)(object)FlagPostPreView != (Object)null)
{
Object.Destroy((Object)(object)FlagPostPreView.gameObject);
}
if ((Object)(object)Anchor != (Object)null)
{
Object.Destroy((Object)(object)Anchor);
}
if ((Object)(object)AnchorGM != (Object)null)
{
Object.Destroy((Object)(object)AnchorGM);
}
TransformAccuired = false;
}
}
Scene activeScene2 = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene2)).name != "GreenScreenSpace")
{
if ((Object)(object)FlagPostRed != (Object)null)
{
Object.Destroy((Object)(object)FlagPostRed.gameObject);
}
if ((Object)(object)FlagPostGreen != (Object)null)
{
Object.Destroy((Object)(object)FlagPostGreen.gameObject);
}
if ((Object)(object)FlagPostPreView != (Object)null)
{
Object.Destroy((Object)(object)FlagPostPreView.gameObject);
}
pos = Vector3.zero;
rot = Vector3.zero;
shouldsetred = false;
}
}
}
public class FlagPostRed : MonoBehaviour
{
public FlagPostRed OtherAnchor;
public float cd = 0.25f;
public bool isRoot;
private void FixedUpdate()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
if (isRoot)
{
((Component)this).gameObject.transform.eulerAngles = new Vector3(0f, 0f, 0f);
}
if (!isRoot)
{
((Component)this).gameObject.transform.eulerAngles = new Vector3(0f, 90f, 0f);
}
if (cd > 0f)
{
cd -= Time.deltaTime;
}
if (!(cd <= 0f))
{
return;
}
cd = 0f;
if ((Object)(object)OtherAnchor == (Object)null)
{
FlagPostRed[] array = Object.FindObjectsOfType<FlagPostRed>();
if (array.Length > 0)
{
for (int i = 0; i < array.Length; i++)
{
if ((Object)(object)array[i] != (Object)(object)this)
{
OtherAnchor = array[i];
}
}
}
}
if ((Object)(object)OtherAnchor != (Object)null)
{
((Component)this).gameObject.transform.position = ((Component)OtherAnchor).gameObject.transform.position;
Object.Destroy((Object)(object)((Component)this).gameObject);
}
isRoot = true;
}
private void OnDisable()
{
isRoot = false;
cd = 0.25f;
}
}
public class GraabTransfer : MonoBehaviour
{
public FVRInteractiveObject grab;
public FVRInteractiveObject targ;
public Collider col;
private void Update()
{
if (!targ.m_isHeld)
{
grab.ForceBreakInteraction();
col.enabled = false;
}
if (targ.m_isHeld)
{
col.enabled = true;
}
}
}
public class ObjShapeChanger : MonoBehaviour
{
public enum Type
{
Capsule,
Cube,
Cylinder,
Sphere
}
public FVRObject refposID;
public GameObject SphereInst;
public FVRFireArmMagazine main;
public Type Shape;
public GameObject whole;
public GameObject up;
public GameObject down;
public GameObject uppos;
public GameObject downpos;
public GameObject refposholderout;
public GameObject refposholder;
public GameObject refpos;
public GameObject refposWorld;
public MeshRenderer Green;
public MeshRenderer White;
public MeshRenderer GreenUp;
public MeshRenderer WhiteUp;
public MeshRenderer GreenDown;
public MeshRenderer WhiteDown;
public float cd = 0f;
public FVRInteractiveObject grab;
public Collider col;
public Material GreenMat;
public Material WhiteMat;
public Material GreenMatS;
public Material WhiteMatS;
public bool refFound;
public bool noRef;
private static int s_nextRoundNumber = 0;
private static List<GameObject> s_claimedRefObjects = new List<GameObject>();
public int r;
public void Start()
{
if ((Object)(object)main != (Object)null)
{
if (main.m_numRounds <= 0)
{
main.m_numRounds = AllocateUniqueRoundNumber();
}
else if (main.m_numRounds > s_nextRoundNumber)
{
s_nextRoundNumber = main.m_numRounds;
}
}
if ((Object)(object)refposholderout != (Object)null)
{
refposholderout.transform.SetParent((Transform)null);
}
}
private int AllocateUniqueRoundNumber()
{
int i;
for (i = s_nextRoundNumber + 1; IsPersistentRoundNumberUsed(i); i++)
{
}
s_nextRoundNumber = i;
return i;
}
private bool IsPersistentRoundNumberUsed(int number)
{
FVRFireArmMagazine[] array = Object.FindObjectsOfType<FVRFireArmMagazine>();
for (int i = 0; i < array.Length; i++)
{
if ((Object)(object)array[i] != (Object)null && array[i].m_numRounds == number)
{
return true;
}
}
ObjShapeChanger[] array2 = Object.FindObjectsOfType<ObjShapeChanger>();
for (int i = 0; i < array2.Length; i++)
{
if ((Object)(object)array2[i] != (Object)null && (Object)(object)array2[i].main != (Object)null && (Object)(object)array2[i].main != (Object)(object)main && array2[i].main.m_numRounds == number)
{
return true;
}
}
return false;
}
private string GetRefObjectName()
{
if (Shape == Type.Capsule)
{
return "refCapsule(Clone)";
}
if (Shape == Type.Cube)
{
return "refCube(Clone)";
}
if (Shape == Type.Cylinder)
{
return "refCylinder(Clone)";
}
return "refSphere(Clone)";
}
private void CleanupClaimedRefObjects()
{
for (int num = s_claimedRefObjects.Count - 1; num >= 0; num--)
{
if ((Object)(object)s_claimedRefObjects[num] == (Object)null)
{
s_claimedRefObjects.RemoveAt(num);
}
}
}
private bool IsRefClaimed(GameObject obj)
{
if ((Object)(object)obj == (Object)null)
{
return false;
}
CleanupClaimedRefObjects();
return s_claimedRefObjects.Contains(obj);
}
private void ClaimRef(GameObject obj)
{
if (!((Object)(object)obj == (Object)null))
{
CleanupClaimedRefObjects();
if (!s_claimedRefObjects.Contains(obj))
{
s_claimedRefObjects.Add(obj);
}
}
}
private bool IsRefAlreadyBoundToAnotherChanger(GameObject obj)
{
if ((Object)(object)obj == (Object)null)
{
return false;
}
ObjShapeChanger[] array = Object.FindObjectsOfType<ObjShapeChanger>();
for (int i = 0; i < array.Length; i++)
{
if ((Object)(object)array[i] != (Object)null && (Object)(object)array[i] != (Object)(object)this && (Object)(object)array[i].refposWorld == (Object)(object)obj)
{
return true;
}
}
return false;
}
private void AssignNewPersistentId()
{
if (!((Object)(object)main == (Object)null))
{
main.m_numRounds = AllocateUniqueRoundNumber();
}
}
private bool TryFindRefWorld()
{
if ((Object)(object)main == (Object)null)
{
return false;
}
FVRFireArmMagazine[] array = Object.FindObjectsOfType<FVRFireArmMagazine>();
string refObjectName = GetRefObjectName();
for (int i = 0; i < array.Length; i++)
{
if (!((Object)(object)array[i] == (Object)null) && !(((Object)((Component)array[i]).gameObject).name != refObjectName) && array[i].m_numRounds == main.m_numRounds && !IsRefClaimed(((Component)array[i]).gameObject) && !IsRefAlreadyBoundToAnotherChanger(((Component)array[i]).gameObject))
{
refposWorld = ((Component)array[i]).gameObject;
FVRFireArmMagazine component = refposWorld.GetComponent<FVRFireArmMagazine>();
if ((Object)(object)component != (Object)null)
{
component.m_numRounds = main.m_numRounds;
EnsureMagazineRounds(component);
}
ClaimRef(refposWorld);
refFound = true;
noRef = false;
ApplyRefWorld();
return true;
}
}
return false;
}
private void EnsureMagazineRounds(FVRFireArmMagazine magazine)
{
if ((Object)(object)magazine == (Object)null)
{
return;
}
int num = 0;
while (magazine.LoadedRounds != null && magazine.LoadedRounds.Length < magazine.m_numRounds && num < 256)
{
int num2 = magazine.LoadedRounds.Length;
magazine.AddRound((FireArmRoundClass)1, false, false);
num++;
if (magazine.LoadedRounds == null || magazine.LoadedRounds.Length <= num2)
{
break;
}
}
}
private bool CreateRefWorld()
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)refposID == (Object)null || (Object)(object)refposholder == (Object)null || (Object)(object)refpos == (Object)null || (Object)(object)main == (Object)null)
{
return false;
}
if (Shape == Type.Capsule)
{
ItemSpawnerID spawnerID = IM.GetSpawnerID("refCapsule");
FVRObject mainObject = spawnerID.MainObject;
refposWorld = Object.Instantiate<GameObject>(((AnvilAsset)mainObject).GetGameObject(), refposholder.transform.position, refposholder.transform.rotation);
if ((Object)(object)refposWorld.GetComponent<FVRPhysicalObject>() != (Object)null)
{
refposWorld.GetComponent<FVRPhysicalObject>().IDSpawnedFrom = spawnerID;
}
Debug.Log((object)"refCapsule Deployed.");
}
if (Shape == Type.Cube)
{
ItemSpawnerID spawnerID2 = IM.GetSpawnerID("refCube");
FVRObject mainObject2 = spawnerID2.MainObject;
refposWorld = Object.Instantiate<GameObject>(((AnvilAsset)mainObject2).GetGameObject(), refposholder.transform.position, refposholder.transform.rotation);
if ((Object)(object)refposWorld.GetComponent<FVRPhysicalObject>() != (Object)null)
{
refposWorld.GetComponent<FVRPhysicalObject>().IDSpawnedFrom = spawnerID2;
}
Debug.Log((object)"refCube Deployed.");
}
if (Shape == Type.Cylinder)
{
ItemSpawnerID spawnerID3 = IM.GetSpawnerID("refCylinder");
FVRObject mainObject3 = spawnerID3.MainObject;
refposWorld = Object.Instantiate<GameObject>(((AnvilAsset)mainObject3).GetGameObject(), refposholder.transform.position, refposholder.transform.rotation);
if ((Object)(object)refposWorld.GetComponent<FVRPhysicalObject>() != (Object)null)
{
refposWorld.GetComponent<FVRPhysicalObject>().IDSpawnedFrom = spawnerID3;
}
Debug.Log((object)"refCylinder Deployed.");
}
if (Shape == Type.Sphere)
{
ItemSpawnerID spawnerID4 = IM.GetSpawnerID("refSphere");
FVRObject mainObject4 = spawnerID4.MainObject;
refposWorld = Object.Instantiate<GameObject>(((AnvilAsset)mainObject4).GetGameObject(), refposholder.transform.position, refposholder.transform.rotation);
if ((Object)(object)refposWorld.GetComponent<FVRPhysicalObject>() != (Object)null)
{
refposWorld.GetComponent<FVRPhysicalObject>().IDSpawnedFrom = spawnerID4;
}
Debug.Log((object)"refSphere Deployed.");
}
if ((Object)(object)refposWorld == (Object)null)
{
return false;
}
FVRFireArmMagazine component = refposWorld.GetComponent<FVRFireArmMagazine>();
if ((Object)(object)component == (Object)null)
{
Object.Destroy((Object)(object)refposWorld);
refposWorld = null;
return false;
}
component.m_numRounds = main.m_numRounds;
EnsureMagazineRounds(component);
refposWorld.transform.position = refpos.transform.position;
ClaimRef(refposWorld);
refFound = true;
noRef = false;
return true;
}
private void FindOrCreateRefWorld()
{
if ((Object)(object)refposWorld != (Object)null || (Object)(object)main == (Object)null)
{
return;
}
refFound = false;
noRef = false;
if (!TryFindRefWorld())
{
if (HasClaimedRefWithSameId())
{
AssignNewPersistentId();
}
noRef = true;
CreateRefWorld();
}
}
private bool HasClaimedRefWithSameId()
{
if ((Object)(object)main == (Object)null)
{
return false;
}
FVRFireArmMagazine[] array = Object.FindObjectsOfType<FVRFireArmMagazine>();
string refObjectName = GetRefObjectName();
for (int i = 0; i < array.Length; i++)
{
if ((Object)(object)array[i] != (Object)null && ((Object)((Component)array[i]).gameObject).name == refObjectName && array[i].m_numRounds == main.m_numRounds && (IsRefClaimed(((Component)array[i]).gameObject) || IsRefAlreadyBoundToAnotherChanger(((Component)array[i]).gameObject)))
{
return true;
}
}
return false;
}
private void ApplyRefWorld()
{
//IL_0050: 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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: 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_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)refposWorld == (Object)null || (Object)(object)refpos == (Object)null || (Object)(object)main == (Object)null)
{
return;
}
refpos.transform.position = refposWorld.transform.position;
if (Shape == Type.Capsule)
{
CapsuleCollider component = ((Component)main).gameObject.GetComponent<CapsuleCollider>();
if ((Object)(object)component != (Object)null)
{
component.radius = refpos.transform.localPosition.z;
component.height = refpos.transform.localPosition.y * 2f;
}
}
else if (Shape == Type.Cube)
{
BoxCollider component2 = ((Component)main).gameObject.GetComponent<BoxCollider>();
if ((Object)(object)component2 != (Object)null)
{
component2.size = new Vector3(refpos.transform.localPosition.x * 2f, refpos.transform.localPosition.y * 2f, refpos.transform.localPosition.z * 2f);
}
}
else if (Shape == Type.Cylinder)
{
CapsuleCollider component3 = ((Component)main).gameObject.GetComponent<CapsuleCollider>();
if ((Object)(object)component3 != (Object)null)
{
component3.radius = refpos.transform.localPosition.z;
component3.height = refpos.transform.localPosition.y * 2f;
}
}
else if (Shape == Type.Sphere)
{
SphereCollider component4 = ((Component)main).gameObject.GetComponent<SphereCollider>();
if ((Object)(object)component4 != (Object)null)
{
component4.radius = refpos.transform.localPosition.z;
}
}
}
private MeshRenderer FindMeshRendererInChildren(GameObject root, int index)
{
if ((Object)(object)root == (Object)null)
{
return null;
}
MeshRenderer[] componentsInChildren = root.GetComponentsInChildren<MeshRenderer>(true);
if (componentsInChildren == null || componentsInChildren.Length <= index)
{
return null;
}
return componentsInChildren[index];
}
private void SetupUpDownRenderers()
{
if ((Object)(object)up != (Object)null)
{
MeshRenderer[] componentsInChildren = up.GetComponentsInChildren<MeshRenderer>(true);
if (componentsInChildren != null)
{
if (componentsInChildren.Length > 0)
{
GreenUp = componentsInChildren[0];
}
if (componentsInChildren.Length > 1)
{
WhiteUp = componentsInChildren[1];
}
}
if ((Object)(object)up.transform.parent != (Object)null)
{
up.transform.SetParent((Transform)null);
}
}
if (!((Object)(object)down != (Object)null))
{
return;
}
MeshRenderer[] componentsInChildren2 = down.GetComponentsInChildren<MeshRenderer>(true);
if (componentsInChildren2 != null)
{
if (componentsInChildren2.Length > 0)
{
GreenDown = componentsInChildren2[0];
}
if (componentsInChildren2.Length > 1)
{
WhiteDown = componentsInChildren2[1];
}
}
if ((Object)(object)down.transform.parent != (Object)null)
{
down.transform.SetParent((Transform)null);
}
}
private void FixedUpdate()
{
if ((Object)(object)refposWorld != (Object)null && (Object)(object)refposWorld.GetComponent<FVRFireArmMagazine>() != (Object)null && refposWorld.GetComponent<FVRFireArmMagazine>().LoadedRounds.Length >= refposWorld.GetComponent<FVRFireArmMagazine>().m_numRounds)
{
for (int i = 0; i < refposWorld.GetComponent<FVRFireArmMagazine>().m_numRounds; i++)
{
if (i > 0 && refposWorld.GetComponent<FVRFireArmMagazine>().LoadedRounds[0] != null)
{
refposWorld.GetComponent<FVRFireArmMagazine>().LoadedRounds[i] = refposWorld.GetComponent<FVRFireArmMagazine>().LoadedRounds[0];
}
}
}
if (main.LoadedRounds.Length < main.m_numRounds)
{
return;
}
for (int j = 0; j < main.m_numRounds; j++)
{
if (j > 0 && main.LoadedRounds[0] != null)
{
main.LoadedRounds[j] = main.LoadedRounds[0];
}
}
}
private void Update()
{
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Expected O, but got Unknown
//IL_0061: 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_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Expected O, but got Unknown
//IL_00a5: 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_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_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_044a: Unknown result type (might be due to invalid IL or missing references)
//IL_044f: 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_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_047d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: 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_01c4: 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_01e3: 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_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0614: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_0633: Unknown result type (might be due to invalid IL or missing references)
//IL_0638: Unknown result type (might be due to invalid IL or missing references)
//IL_0647: Unknown result type (might be due to invalid IL or missing references)
//IL_04af: Unknown result type (might be due to invalid IL or missing references)
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0501: Unknown result type (might be due to invalid IL or missing references)
//IL_0521: Unknown result type (might be due to invalid IL or missing references)
//IL_0675: Unknown result type (might be due to invalid IL or missing references)
//IL_067a: Unknown result type (might be due to invalid IL or missing references)
//IL_0694: Unknown result type (might be due to invalid IL or missing references)
//IL_0699: Unknown result type (might be due to invalid IL or missing references)
//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
//IL_0554: Unknown result type (might be due to invalid IL or missing references)
//IL_0559: Unknown result type (might be due to invalid IL or missing references)
//IL_0573: Unknown result type (might be due to invalid IL or missing references)
//IL_0578: Unknown result type (might be due to invalid IL or missing references)
//IL_0592: Unknown result type (might be due to invalid IL or missing references)
//IL_0597: Unknown result type (might be due to invalid IL or missing references)
//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
//IL_06fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0714: Unknown result type (might be due to invalid IL or missing references)
//IL_0719: Unknown result type (might be due to invalid IL or missing references)
//IL_0733: Unknown result type (might be due to invalid IL or missing references)
//IL_0738: Unknown result type (might be due to invalid IL or missing references)
//IL_0747: Unknown result type (might be due to invalid IL or missing references)
//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
//IL_097c: Unknown result type (might be due to invalid IL or missing references)
//IL_0981: Unknown result type (might be due to invalid IL or missing references)
//IL_0992: Unknown result type (might be due to invalid IL or missing references)
//IL_09a7: Unknown result type (might be due to invalid IL or missing references)
//IL_09c0: Unknown result type (might be due to invalid IL or missing references)
//IL_09d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0acb: Unknown result type (might be due to invalid IL or missing references)
//IL_0aa6: Unknown result type (might be due to invalid IL or missing references)
//IL_0b1f: Unknown result type (might be due to invalid IL or missing references)
//IL_0b4e: Unknown result type (might be due to invalid IL or missing references)
//IL_0ca7: Unknown result type (might be due to invalid IL or missing references)
//IL_0b8d: Unknown result type (might be due to invalid IL or missing references)
//IL_0d79: Unknown result type (might be due to invalid IL or missing references)
//IL_0d7e: Unknown result type (might be due to invalid IL or missing references)
//IL_0ce8: Unknown result type (might be due to invalid IL or missing references)
//IL_0ced: Unknown result type (might be due to invalid IL or missing references)
//IL_0d07: Unknown result type (might be due to invalid IL or missing references)
//IL_0d0c: Unknown result type (might be due to invalid IL or missing references)
//IL_0d26: Unknown result type (might be due to invalid IL or missing references)
//IL_0d2b: Unknown result type (might be due to invalid IL or missing references)
//IL_0d3a: Unknown result type (might be due to invalid IL or missing references)
//IL_0bf1: Unknown result type (might be due to invalid IL or missing references)
//IL_0bf6: Unknown result type (might be due to invalid IL or missing references)
//IL_0bc0: Unknown result type (might be due to invalid IL or missing references)
//IL_0e3b: Unknown result type (might be due to invalid IL or missing references)
//IL_0e40: Unknown result type (might be due to invalid IL or missing references)
//IL_0dbf: Unknown result type (might be due to invalid IL or missing references)
//IL_0dc4: Unknown result type (might be due to invalid IL or missing references)
//IL_0ded: Unknown result type (might be due to invalid IL or missing references)
//IL_0df2: Unknown result type (might be due to invalid IL or missing references)
//IL_0c37: Unknown result type (might be due to invalid IL or missing references)
//IL_0c3c: Unknown result type (might be due to invalid IL or missing references)
//IL_0c65: Unknown result type (might be due to invalid IL or missing references)
//IL_0c6a: Unknown result type (might be due to invalid IL or missing references)
//IL_0e81: Unknown result type (might be due to invalid IL or missing references)
//IL_0e86: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)refposWorld == (Object)null && (Object)(object)main != (Object)null)
{
FindOrCreateRefWorld();
}
if ((Object)(object)SphereInst != (Object)null)
{
if ((Object)(object)up == (Object)null)
{
up = Object.Instantiate<GameObject>(SphereInst, uppos.transform.position, uppos.transform.rotation);
}
if ((Object)(object)down == (Object)null)
{
down = Object.Instantiate<GameObject>(SphereInst, downpos.transform.position, downpos.transform.rotation);
}
SetupUpDownRenderers();
if (Shape == Type.Capsule)
{
if ((Object)(object)up != (Object)null)
{
up.transform.localScale = new Vector3(refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f);
up.transform.position = uppos.transform.position;
}
if ((Object)(object)down != (Object)null)
{
up.transform.localScale = new Vector3(refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f);
down.transform.position = downpos.transform.position;
}
}
}
if ((Object)(object)GreenMat == (Object)null)
{
GreenMat = new Material(GreenMatS);
if ((Object)(object)Green != (Object)null)
{
((Renderer)Green).material = GreenMat;
}
if ((Object)(object)GreenUp != (Object)null)
{
((Renderer)GreenUp).material = GreenMat;
}
if ((Object)(object)GreenDown != (Object)null)
{
((Renderer)GreenDown).material = GreenMat;
}
}
if ((Object)(object)WhiteMat == (Object)null)
{
WhiteMat = new Material(WhiteMatS);
if ((Object)(object)White != (Object)null)
{
((Renderer)White).material = WhiteMat;
}
if ((Object)(object)WhiteUp != (Object)null)
{
((Renderer)WhiteUp).material = WhiteMat;
}
if ((Object)(object)WhiteDown != (Object)null)
{
((Renderer)WhiteDown).material = WhiteMat;
}
}
if ((Object)(object)refpos != (Object)null && (Object)(object)refposWorld != (Object)null && (Object)(object)refpos.GetComponent<FVRFireArmMagazine>() != (Object)null && (Object)(object)refposWorld.GetComponent<FVRFireArmMagazine>() != (Object)null && refposWorld.GetComponent<FVRFireArmMagazine>().LoadedRounds.Length < refposWorld.GetComponent<FVRFireArmMagazine>().m_numRounds)
{
refposWorld.GetComponent<FVRFireArmMagazine>().AddRound((FireArmRoundClass)1, false, false);
}
if ((Object)(object)main != (Object)null && main.LoadedRounds.Length < main.m_numRounds)
{
main.AddRound((FireArmRoundClass)1, false, false);
}
if (Shape == Type.Capsule)
{
whole.transform.localScale = new Vector3(refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.y * 20f, refpos.transform.localPosition.z * 20f);
if ((Object)(object)up != (Object)null)
{
up.transform.localScale = new Vector3(refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f);
up.transform.position = uppos.transform.position;
}
if ((Object)(object)down != (Object)null)
{
down.transform.localScale = new Vector3(refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f);
down.transform.position = downpos.transform.position;
}
}
if (Shape == Type.Cube)
{
whole.transform.localScale = new Vector3(refpos.transform.localPosition.x * 20f, refpos.transform.localPosition.y * 20f, refpos.transform.localPosition.z * 20f);
}
if (Shape == Type.Cylinder)
{
whole.transform.localScale = new Vector3(refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.y * 10f, refpos.transform.localPosition.z * 20f);
}
if (Shape == Type.Sphere)
{
whole.transform.localScale = new Vector3(refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f, refpos.transform.localPosition.z * 20f);
}
if (((FVRInteractiveObject)main).m_isHeld)
{
col.enabled = false;
}
if (!((FVRInteractiveObject)main).m_isHeld)
{
if (cd >= 1f)
{
col.enabled = true;
}
if (cd < 1f)
{
col.enabled = false;
}
}
refposholderout.transform.position = ((Component)main).gameObject.transform.position;
refposholderout.transform.rotation = ((Component)main).gameObject.transform.rotation;
if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && GM.CurrentMovementManager.Hands[0].Input.GripPressed && GM.CurrentMovementManager.Hands[1].Input.GripPressed)
{
cd = Mathf.Lerp(cd, 5f, Time.deltaTime);
}
if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null || (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null || !GM.CurrentMovementManager.Hands[0].Input.GripPressed || !GM.CurrentMovementManager.Hands[1].Input.GripPressed)
{
if (((FVRInteractiveObject)main).m_isHeld)
{
cd = Mathf.Lerp(cd, 5f, Time.deltaTime);
}
if (!((FVRInteractiveObject)main).m_isHeld)
{
cd = Mathf.Lerp(cd, 0f, Time.deltaTime);
}
}
WhiteMat.SetColor("_Color", Color.Lerp(new Color(1f, 1f, 1f, 0f), Color.white, cd / 5f));
GreenMat.SetColor("_Color", Color.Lerp(Color.green, new Color(0f, 1f, 0f, 0f), cd / 5f));
if (cd >= 1f)
{
((FVRInteractiveObject)main).IsSimpleInteract = false;
grab.IsSimpleInteract = false;
((FVRPhysicalObject)main).DistantGrabbable = true;
}
if (cd < 1f)
{
((FVRInteractiveObject)main).ForceBreakInteraction();
((FVRInteractiveObject)main).IsSimpleInteract = true;
((FVRPhysicalObject)main).DistantGrabbable = false;
grab.ForceBreakInteraction();
grab.IsSimpleInteract = true;
}
if (!((FVRInteractiveObject)main).m_isHeld || !grab.m_isHeld)
{
if ((Object)(object)refposWorld != (Object)null)
{
refposWorld.transform.position = refpos.transform.position;
}
refposholder.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
}
if (!((FVRInteractiveObject)main).m_isHeld || !grab.m_isHeld)
{
return;
}
if ((Object)(object)refposWorld != (Object)null)
{
refpos.transform.position = refposWorld.transform.position;
refposWorld.transform.position = ((Component)((FVRInteractiveObject)main).m_hand.OtherHand).gameObject.transform.position;
}
if (Shape == Type.Capsule)
{
if ((Object)(object)up != (Object)null)
{
up.transform.position = uppos.transform.position;
}
if ((Object)(object)down != (Object)null)
{
down.transform.position = downpos.transform.position;
}
AxisLookAt(refposholder.transform, ((Component)((FVRInteractiveObject)main).m_hand.OtherHand).gameObject.transform.position, Vector3.forward);
if ((Object)(object)((Component)main).gameObject.GetComponent<CapsuleCollider>() != (Object)null)
{
((Component)main).gameObject.GetComponent<CapsuleCollider>().radius = refpos.transform.localPosition.z;
((Component)main).gameObject.GetComponent<CapsuleCollider>().height = refpos.transform.localPosition.y * 4f;
}
}
if (Shape == Type.Cube)
{
refposholder.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
if ((Object)(object)((Component)main).gameObject.GetComponent<BoxCollider>() != (Object)null)
{
((Component)main).gameObject.GetComponent<BoxCollider>().size = new Vector3(refpos.transform.localPosition.x * 2f, refpos.transform.localPosition.y * 2f, refpos.transform.localPosition.z * 2f);
}
}
if (Shape == Type.Cylinder)
{
AxisLookAt(refposholder.transform, ((Component)((FVRInteractiveObject)main).m_hand.OtherHand).gameObject.transform.position, Vector3.forward);
if ((Object)(object)((Component)main).gameObject.GetComponent<CapsuleCollider>() != (Object)null)
{
((Component)main).gameObject.GetComponent<CapsuleCollider>().radius = refpos.transform.localPosition.z;
((Component)main).gameObject.GetComponent<CapsuleCollider>().height = refpos.transform.localPosition.y * 2f;
}
}
if (Shape == Type.Sphere)
{
AxisLookAt2(refposholder.transform, ((Component)((FVRInteractiveObject)main).m_hand.OtherHand).gameObject.transform.position, Vector3.forward);
if ((Object)(object)((Component)main).gameObject.GetComponent<SphereCollider>() != (Object)null)
{
((Component)main).gameObject.GetComponent<SphereCollider>().radius = refpos.transform.localPosition.z;
}
}
}
private void AxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
{
//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_0008: 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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
Quaternion rotation = tr_self.rotation;
Vector3 val = lookPos - tr_self.position;
Vector3 val2 = tr_self.rotation * directionAxis;
Vector3 val3 = Vector3.Cross(val2, val);
Vector3 normalized = ((Vector3)(ref val3)).normalized;
float num = Vector3.Angle(val2, val);
tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
tr_self.localEulerAngles = new Vector3(0f, tr_self.localEulerAngles.y, 0f);
}
private void AxisLookAt2(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
{
//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_0008: 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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
Quaternion rotation = tr_self.rotation;
Vector3 val = lookPos - tr_self.position;
Vector3 val2 = tr_self.rotation * directionAxis;
Vector3 val3 = Vector3.Cross(val2, val);
Vector3 normalized = ((Vector3)(ref val3)).normalized;
float num = Vector3.Angle(val2, val);
tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
tr_self.localEulerAngles = new Vector3(tr_self.localEulerAngles.x, tr_self.localEulerAngles.y, 0f);
}
private void OnDestroy()
{
if ((Object)(object)up != (Object)null)
{
Object.Destroy((Object)(object)up);
}
if ((Object)(object)down != (Object)null)
{
Object.Destroy((Object)(object)down);
}
if ((Object)(object)refposholderout != (Object)null)
{
Object.Destroy((Object)(object)refposholderout);
}
}
}
public class SpawnerHide : MonoBehaviour
{
public ItemSpawnerV2 spawner;
private void Update()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)spawner == (Object)null)
{
spawner = Object.FindObjectOfType<ItemSpawnerV2>();
}
if ((Object)(object)spawner != (Object)null)
{
((Component)spawner).gameObject.transform.localScale = new Vector3(0f, 0f, 0f);
}
}
}
}