using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using H3VRAnimator.Logging;
using H3VRAnimator.Utilities;
using HarmonyLib;
using Popcron;
using Stratum;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace JerryAr.H3VR_Animation_Studio
{
[BepInPlugin("JerryAr.H3VR_Animation_Studio", "H3VR_Animation_Studio", "0.4.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
public class H3VR_Animation_StudioPlugin : 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.H3VR_Animation_Studio");
}
}
}
namespace H3VRAnimator
{
public enum AnimationEventType
{
FireGun,
ReleaseMagazine
}
public static class AnimationEvents
{
public static void MoveToPath(AnimatedPoint eventTarget, AnimationPath path)
{
FVRPhysicalObject interactable = eventTarget.interactable;
eventTarget.interactable = null;
path.AddAnimatedPoint(interactable);
}
public static void DuplicateToPath(AnimatedPoint eventTarget, AnimationPath path)
{
//IL_0018: 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)
FVRPhysicalObject physObj = Object.Instantiate<FVRPhysicalObject>(eventTarget.interactable, ((Component)path.points[0]).transform.position, ((Component)path.points[0].rotationPoint).transform.rotation);
path.AddAnimatedPoint(physObj);
}
}
public static class FirearmEvents
{
public static void FireGun(AnimatedPoint eventTarget)
{
//IL_0032: 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)
if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<Handgun>() != (Object)null)
{
if ((int)((Component)eventTarget.interactable).gameObject.GetComponent<Handgun>().Slide.CurPos == 0)
{
((Component)eventTarget.interactable).gameObject.GetComponent<Handgun>().ReleaseSeer();
((Component)eventTarget.interactable).gameObject.GetComponent<Handgun>().HasTriggerReset = true;
((Component)eventTarget.interactable).gameObject.GetComponent<Handgun>().m_isSeerReady = true;
}
}
else if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<ClosedBoltWeapon>() != (Object)null)
{
if ((int)((Component)eventTarget.interactable).gameObject.GetComponent<ClosedBoltWeapon>().Bolt.CurPos == 0)
{
((Component)eventTarget.interactable).gameObject.GetComponent<ClosedBoltWeapon>().DropHammer();
}
}
else if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<OpenBoltReceiver>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<OpenBoltReceiver>().ReleaseSeer();
}
else if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<BoltActionRifle>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<BoltActionRifle>().DropHammer();
}
else if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<BreakActionWeapon>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<BreakActionWeapon>().DropHammer();
}
else if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<Derringer>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<Derringer>().DropHammer();
}
else if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<LeverActionFirearm>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<LeverActionFirearm>().Fire();
}
else if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<TubeFedShotgun>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<TubeFedShotgun>().ReleaseHammer();
}
}
public static void ReleaseMagazine(AnimatedPoint eventTarget)
{
if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<FVRFireArm>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<FVRFireArm>().EjectMag(false);
}
}
public static void RackSlide(AnimatedPoint eventTarget)
{
if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<Handgun>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<Handgun>().Slide.ImpartFiringImpulse();
}
else if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<ClosedBoltWeapon>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<ClosedBoltWeapon>().Bolt.ImpartFiringImpulse();
}
else if ((Object)(object)((Component)eventTarget.interactable).gameObject.GetComponent<OpenBoltReceiver>() != (Object)null)
{
((Component)eventTarget.interactable).gameObject.GetComponent<OpenBoltReceiver>().Bolt.ImpartFiringImpulse();
}
}
}
public static class InteractionEvents
{
public static void TouchpadPressed(AnimatedPoint eventTarget, Vector2 pressDir)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: 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)
eventTarget.fakeHand.Input.TouchpadDown = true;
eventTarget.fakeHand.Input.TouchpadPressed = true;
eventTarget.fakeHand.Input.TouchpadAxes = pressDir;
((FVRInteractiveObject)eventTarget.interactable).UpdateInteraction(eventTarget.fakeHand);
eventTarget.fakeHand.Input.TouchpadDown = false;
eventTarget.fakeHand.Input.TouchpadPressed = false;
eventTarget.fakeHand.Input.TouchpadAxes = Vector2.zero;
((FVRInteractiveObject)eventTarget.interactable).UpdateInteraction(eventTarget.fakeHand);
}
public static void TouchpadHold(AnimatedPoint eventTarget, Vector2 pressDir)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
eventTarget.fakeHand.Input.TouchpadDown = true;
eventTarget.fakeHand.Input.TouchpadPressed = true;
eventTarget.fakeHand.Input.TouchpadAxes = pressDir;
((FVRInteractiveObject)eventTarget.interactable).UpdateInteraction(eventTarget.fakeHand);
eventTarget.fakeHand.Input.TouchpadDown = false;
}
public static void TouchpadRelease(AnimatedPoint eventTarget)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
eventTarget.fakeHand.Input.TouchpadDown = false;
eventTarget.fakeHand.Input.TouchpadUp = true;
eventTarget.fakeHand.Input.TouchpadPressed = false;
eventTarget.fakeHand.Input.TouchpadAxes = Vector2.zero;
((FVRInteractiveObject)eventTarget.interactable).UpdateInteraction(eventTarget.fakeHand);
eventTarget.fakeHand.Input.TouchpadUp = false;
}
public static void PullTrigger(AnimatedPoint eventTarget)
{
eventTarget.fakeHand.Input.TriggerDown = true;
eventTarget.fakeHand.Input.TriggerPressed = true;
eventTarget.fakeHand.Input.TriggerFloat = 1f;
((FVRInteractiveObject)eventTarget.interactable).UpdateInteraction(eventTarget.fakeHand);
eventTarget.fakeHand.Input.TriggerDown = false;
eventTarget.fakeHand.Input.TriggerPressed = false;
eventTarget.fakeHand.Input.TriggerFloat = 0f;
((FVRInteractiveObject)eventTarget.interactable).UpdateInteraction(eventTarget.fakeHand);
}
public static void HoldTrigger(AnimatedPoint eventTarget)
{
eventTarget.fakeHand.Input.TriggerDown = true;
eventTarget.fakeHand.Input.TriggerPressed = true;
eventTarget.fakeHand.Input.TriggerFloat = 1f;
((FVRInteractiveObject)eventTarget.interactable).UpdateInteraction(eventTarget.fakeHand);
eventTarget.fakeHand.Input.TriggerDown = false;
}
public static void ReleaseTrigger(AnimatedPoint eventTarget)
{
eventTarget.fakeHand.Input.TriggerDown = false;
eventTarget.fakeHand.Input.TriggerUp = true;
eventTarget.fakeHand.Input.TriggerPressed = false;
eventTarget.fakeHand.Input.TriggerFloat = 0f;
((FVRInteractiveObject)eventTarget.interactable).UpdateInteraction(eventTarget.fakeHand);
eventTarget.fakeHand.Input.TriggerUp = false;
}
}
public static class PhysicalObjectEvents
{
public static void DropItem(AnimatedPoint eventTarget)
{
FVRPhysicalObject interactable = eventTarget.interactable;
eventTarget.interactable = null;
((FVRInteractiveObject)interactable).IsHeld = false;
((FVRInteractiveObject)interactable).m_hand = null;
interactable.RootRigidbody.useGravity = true;
}
public static void DropItemWithVelocity(AnimatedPoint eventTarget)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
FVRPhysicalObject interactable = eventTarget.interactable;
eventTarget.interactable = null;
((FVRInteractiveObject)interactable).IsHeld = false;
((FVRInteractiveObject)interactable).m_hand = null;
interactable.RootRigidbody.useGravity = true;
interactable.RootRigidbody.velocity = (((Component)eventTarget).transform.position - eventTarget.prevVector) / Time.deltaTime;
}
}
public class AnimationPath
{
private struct CachedCurveData
{
public Vector3 position;
public float distance;
public float t;
}
public List<PathAnchor> points = new List<PathAnchor>();
public List<AnimatedPoint> animations = new List<AnimatedPoint>();
public bool isPaused = false;
public bool isBezier = true;
public bool isContinuous = false;
public bool onlyDrawPoints = false;
public bool drawRotation = false;
public int bezierMidPoints = 10;
public bool drawGizmos = true;
public string pathName = "Path";
private CachedCurveData[] cachedCurveData = new CachedCurveData[11];
public void AddPoint(Vector3 position)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("MovablePoint");
val.transform.position = position;
FVRViveHand nonPointingHand = AnimationUtils.GetNonPointingHand();
if ((Object)(object)nonPointingHand.CurrentInteractable != (Object)null && (Object)(object)((Component)nonPointingHand.CurrentInteractable).GetComponent<SpectatorPanel>() == (Object)null)
{
val.transform.SetParent(((Component)nonPointingHand.CurrentInteractable).transform);
}
PathAnchor pathAnchor = val.AddComponent<PathAnchor>();
pathAnchor.path = this;
points.Add(pathAnchor);
UpdateControlPoints();
}
public void AddAnimatedPoint(FVRPhysicalObject physObj)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("AnimatedPoint");
val.transform.position = ((Component)points[0]).transform.position;
AnimatedPoint animatedPoint = val.AddComponent<AnimatedPoint>();
animatedPoint.path = this;
animatedPoint.from = points[0];
animatedPoint.to = GetNextPoint(animatedPoint.from);
animatedPoint.offset = new Vector3(0f, -0.1f, 0f);
animatedPoint.pointColor = Color.green;
animatedPoint.radius = 0.005f;
animatedPoint.isPaused = isPaused;
animatedPoint.SetInteractable(physObj);
animatedPoint.drawGizmos = drawGizmos;
animations.Add(animatedPoint);
((Component)physObj).transform.position = ((Component)points[0]).transform.position;
((Component)physObj).transform.rotation = ((Component)points[0].rotationPoint).transform.rotation;
}
public void DrawPath()
{
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: 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_00fd: 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)
if (!drawGizmos)
{
return;
}
if (isBezier)
{
for (int i = 1; i < points.Count; i++)
{
PathAnchor pathAnchor = points[i - 1];
PathAnchor pathAnchor2 = points[i];
if (pathAnchor.isJumpPoint)
{
Gizmos.Line(((Component)pathAnchor).transform.position, ((Component)pathAnchor2).transform.position, (Color?)Color.grey, false);
}
else
{
DrawBezierCurve(pathAnchor, pathAnchor2);
}
if (drawRotation)
{
DrawRotation(pathAnchor, pathAnchor2);
}
}
if (isContinuous)
{
PathAnchor pathAnchor3 = points[points.Count - 1];
PathAnchor pathAnchor4 = points[0];
if (pathAnchor3.isJumpPoint)
{
Gizmos.Line(((Component)pathAnchor3).transform.position, ((Component)pathAnchor4).transform.position, (Color?)Color.grey, false);
}
else
{
DrawBezierCurve(pathAnchor3, pathAnchor4);
}
if (drawRotation)
{
DrawRotation(pathAnchor3, pathAnchor4);
}
}
return;
}
for (int j = 1; j < points.Count; j++)
{
PathAnchor pathAnchor5 = points[j - 1];
PathAnchor pathAnchor6 = points[j];
if (pathAnchor5.isJumpPoint)
{
Gizmos.Line(((Component)pathAnchor5).transform.position, ((Component)pathAnchor6).transform.position, (Color?)Color.grey, false);
}
else
{
Gizmos.Line(((Component)pathAnchor5).transform.position, ((Component)pathAnchor6).transform.position, (Color?)Color.red, false);
}
if (drawRotation)
{
DrawRotation(pathAnchor5, pathAnchor6);
}
}
if (isContinuous)
{
PathAnchor pathAnchor7 = points[points.Count - 1];
PathAnchor pathAnchor8 = points[0];
if (pathAnchor7.isJumpPoint)
{
Gizmos.Line(((Component)pathAnchor7).transform.position, ((Component)pathAnchor8).transform.position, (Color?)Color.grey, false);
}
else
{
Gizmos.Line(((Component)pathAnchor7).transform.position, ((Component)pathAnchor8).transform.position, (Color?)Color.red, false);
}
if (drawRotation)
{
DrawRotation(pathAnchor7, pathAnchor8);
}
}
}
private void DrawBezierCurve(PathAnchor from, PathAnchor to)
{
//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_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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)from).transform.position;
for (int i = 1; i <= bezierMidPoints; i++)
{
float t = (float)i / (float)bezierMidPoints;
Vector3 lerpPosition = GetLerpPosition(from, to, t);
if (onlyDrawPoints)
{
Gizmos.Sphere(lerpPosition, 0.005f, (Color?)Color.red, false, 16);
}
else
{
Gizmos.Line(val, lerpPosition, (Color?)Color.red, false);
}
val = lerpPosition;
}
}
private void DrawRotation(PathAnchor from, PathAnchor to)
{
//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_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_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)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
for (int i = 1; i <= bezierMidPoints; i++)
{
float t = (float)i / (float)bezierMidPoints;
Vector3 lerpPosition = GetLerpPosition(from, to, t);
Quaternion lerpRotation = GetLerpRotation(from, to, t);
Gizmos.Line(lerpPosition, lerpPosition + lerpRotation * Vector3.forward * 0.2f, (Color?)Color.red, false);
}
}
private Vector3 QuadraticLerpPosition(Vector3 a, Vector3 b, Vector3 c, float t)
{
//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_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0024: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Vector3.Lerp(a, b, t);
Vector3 val2 = Vector3.Lerp(b, c, t);
return Vector3.Lerp(val, val2, t);
}
private Quaternion QuadraticLerpRotation(Quaternion a, Quaternion b, Quaternion c, float t)
{
//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_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0024: Unknown result type (might be due to invalid IL or missing references)
Quaternion val = Quaternion.Lerp(a, b, t);
Quaternion val2 = Quaternion.Lerp(b, c, t);
return Quaternion.Slerp(val, val2, t);
}
public Vector3 GetLerpPosition(PathAnchor from, PathAnchor to, float t)
{
//IL_0088: 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_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_0014: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
if (isBezier)
{
Vector3 val = QuadraticLerpPosition(((Component)from).transform.position, ((Component)from.forwardPoint).transform.position, ((Component)to.backPoint).transform.position, t);
Vector3 val2 = QuadraticLerpPosition(((Component)from.forwardPoint).transform.position, ((Component)to.backPoint).transform.position, ((Component)to).transform.position, t);
return Vector3.Lerp(val, val2, t);
}
return Vector3.Lerp(((Component)from).transform.position, ((Component)to).transform.position, t);
}
public Quaternion GetLerpRotation(PathAnchor from, PathAnchor to, float t)
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00b8: Unknown result type (might be due to invalid IL or missing references)
if (isBezier)
{
Quaternion val = QuadraticLerpRotation(((Component)from.rotationPoint).transform.rotation, ((Component)from.forwardRotationPoint).transform.rotation, ((Component)to.backRotationPoint).transform.rotation, t);
Quaternion val2 = QuadraticLerpRotation(((Component)from.forwardRotationPoint).transform.rotation, ((Component)to.backRotationPoint).transform.rotation, ((Component)to.rotationPoint).transform.rotation, t);
return Quaternion.Slerp(val, val2, t);
}
return Quaternion.Slerp(((Component)from.rotationPoint).transform.rotation, ((Component)to.rotationPoint).transform.rotation, t);
}
public float GetDistanceBetweenPoints(PathAnchor from, PathAnchor to)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_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)
if (isBezier)
{
Vector3 lerpPosition = GetLerpPosition(from, to, 0.5f);
return Vector3.Distance(((Component)from).transform.position, lerpPosition) + Vector3.Distance(((Component)to).transform.position, lerpPosition);
}
return Vector3.Distance(((Component)from).transform.position, ((Component)to).transform.position);
}
public void DeletePoint(PathAnchor point)
{
PathAnchor prevPoint = GetPrevPoint(point);
foreach (EventPoint events in point.eventsList)
{
events.from = prevPoint;
}
foreach (EventEndPoint eventEnd in point.eventEndList)
{
eventEnd.from = prevPoint;
}
PathAnchor nextPoint = GetNextPoint(point);
foreach (EventPoint events2 in prevPoint.eventsList)
{
events2.to = nextPoint;
}
foreach (EventEndPoint eventEnd2 in prevPoint.eventEndList)
{
eventEnd2.to = nextPoint;
}
foreach (AnimatedPoint animation in animations)
{
if (((object)animation.from).Equals((object?)point))
{
animation.from = prevPoint;
}
if (((object)animation.to).Equals((object?)point))
{
animation.to = nextPoint;
}
}
points.Remove(point);
Object.Destroy((Object)(object)((Component)point).gameObject);
UpdateControlPoints();
}
public void InsertPointAfter(PathAnchor point)
{
//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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//IL_00c1: 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)
int num = points.IndexOf(point);
Vector3 position = ((Component)point).transform.position + Vector3.forward * 0.1f;
if (num < points.Count - 1)
{
position = GetLerpPosition(points[num], points[num + 1], 0.5f);
}
else if (isContinuous && points.Count > 1)
{
position = GetLerpPosition(points[num], points[0], 0.5f);
}
GameObject val = new GameObject("MovablePoint");
val.transform.position = position;
val.transform.SetParent(((Component)point).transform.parent);
PathAnchor pathAnchor = val.AddComponent<PathAnchor>();
pathAnchor.path = this;
foreach (EventPoint events in point.eventsList)
{
events.to = pathAnchor;
}
foreach (EventEndPoint eventEnd in point.eventEndList)
{
eventEnd.to = pathAnchor;
}
foreach (AnimatedPoint animation in animations)
{
if (((object)animation.from).Equals((object?)point))
{
animation.to = pathAnchor;
}
}
points.Insert(num + 1, pathAnchor);
UpdateControlPoints();
}
public PathAnchor GetNextPoint(PathAnchor point)
{
int num = points.IndexOf(point) + 1;
if (num >= points.Count)
{
if (isContinuous)
{
return points[0];
}
return point;
}
return points[num];
}
public PathAnchor GetPrevPoint(PathAnchor point)
{
int num = points.IndexOf(point) - 1;
if (num < 0)
{
if (isContinuous)
{
return points[points.Count - 1];
}
return point;
}
return points[num];
}
public float GetClosestPoint(PathAnchor from, PathAnchor to, Vector3 position)
{
//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_002b: 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_0041: 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_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: 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_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: 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_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
float num2 = float.MaxValue;
for (int i = 0; i < cachedCurveData.Length; i++)
{
float t = (float)i / (float)(cachedCurveData.Length - 1);
Vector3 lerpPosition = GetLerpPosition(from, to, t);
float num3 = Vector3.Distance(lerpPosition, position);
cachedCurveData[i].position = lerpPosition;
cachedCurveData[i].distance = num3;
cachedCurveData[i].t = t;
if (num3 < num2)
{
num = i;
num2 = num3;
}
}
int num4 = ((num == cachedCurveData.Length - 1) ? (num - 1) : ((num == 0) ? 1 : ((!(cachedCurveData[num - 1].distance < cachedCurveData[num + 1].distance)) ? (num + 1) : (num - 1))));
Vector3 val = cachedCurveData[num4].position - cachedCurveData[num].position;
((Vector3)(ref val)).Normalize();
Vector3 val2 = position - cachedCurveData[num].position;
float num5 = Vector3.Dot(val2, val);
Vector3 val3 = cachedCurveData[num].position + val * num5;
cachedCurveData[num].distance = Vector3.Distance(val3, cachedCurveData[num].position);
cachedCurveData[num4].distance = Vector3.Distance(val3, cachedCurveData[num4].position);
float num6 = Vector3.Distance(cachedCurveData[num].position, cachedCurveData[num4].position);
if (cachedCurveData[num4].distance > num6)
{
if (num == 0 || num4 == 0)
{
return 0f;
}
if (num == bezierMidPoints || num4 == bezierMidPoints)
{
return 1f;
}
}
if (num < num4)
{
float num7 = cachedCurveData[num].distance / num6;
return Mathf.Lerp(cachedCurveData[num].t, cachedCurveData[num4].t, num7);
}
float num8 = cachedCurveData[num4].distance / num6;
return Mathf.Lerp(cachedCurveData[num4].t, cachedCurveData[num].t, num8);
}
public void DestroyPath()
{
foreach (PathAnchor point in points)
{
Object.Destroy((Object)(object)((Component)point).gameObject);
}
foreach (AnimatedPoint animation in animations)
{
Object.Destroy((Object)(object)((Component)animation).gameObject);
}
points.Clear();
animations.Clear();
}
public void TogglePause()
{
isPaused = !isPaused;
foreach (AnimatedPoint animation in animations)
{
AnimLogger.Log("Setting pause for point: " + isPaused);
animation.isPaused = isPaused;
}
}
public void ToggleBezier()
{
isBezier = !isBezier;
UpdateControlPoints();
}
public void ToggleContinuous()
{
isContinuous = !isContinuous;
UpdateControlPoints();
}
public void ToggleLineMode()
{
onlyDrawPoints = !onlyDrawPoints;
}
public void ToggleDrawRotation()
{
drawRotation = !drawRotation;
}
private void UpdateControlPoints()
{
for (int i = 0; i < points.Count; i++)
{
points[i].forwardPoint.drawGizmos = drawGizmos && isBezier && (i < points.Count - 1 || isContinuous);
points[i].backPoint.drawGizmos = drawGizmos && isBezier && (i > 0 || isContinuous);
points[i].forwardPoint.buttonPoint.gameObject.SetActive(drawGizmos && isBezier && (i < points.Count - 1 || isContinuous));
points[i].backPoint.buttonPoint.gameObject.SetActive(drawGizmos && isBezier && (i > 0 || isContinuous));
points[i].forwardRotationPoint.drawGizmos = drawGizmos && isBezier && (i < points.Count - 1 || isContinuous);
points[i].backRotationPoint.drawGizmos = drawGizmos && isBezier && (i > 0 || isContinuous);
points[i].forwardRotationPoint.buttonPoint.gameObject.SetActive(drawGizmos && isBezier && (i < points.Count - 1 || isContinuous));
points[i].backRotationPoint.buttonPoint.gameObject.SetActive(drawGizmos && isBezier && (i > 0 || isContinuous));
}
}
public void ToggleGizmos()
{
drawGizmos = !drawGizmos;
for (int i = 0; i < points.Count; i++)
{
points[i].SetGizmosEnabled(drawGizmos);
}
UpdateControlPoints();
foreach (AnimatedPoint animation in animations)
{
animation.drawGizmos = drawGizmos;
animation.buttonPoint.SetActive(drawGizmos);
}
}
}
[BepInPlugin("devyndamonster.h3vr.animator", "H3VR Animator", "0.4.0")]
[BepInDependency("stratum", "1.1.0")]
[BepInDependency("nrgill28.Sodalite", "1.4.1")]
public class H3VRAnimator : StratumPlugin
{
public static SpectatorPanelAnimator SpectatorPanel;
private void Awake()
{
AnimLogger.Init();
Harmony.CreateAndPatchAll(typeof(H3VRAnimator), (string)null);
}
public override void OnSetup(IStageContext<Empty> ctx)
{
}
public override IEnumerator OnRuntime(IStageContext<IEnumerator> ctx)
{
yield break;
}
[HarmonyPatch(typeof(SpectatorPanelv2), "Start")]
[HarmonyPrefix]
public static bool AddButton(SpectatorPanelv2 __instance)
{
SpectatorPanel = ((Component)__instance).gameObject.AddComponent<SpectatorPanelAnimator>();
return true;
}
[HarmonyPatch(typeof(FVRViveHand), "Awake")]
[HarmonyPrefix]
public static bool PreventAwake(FVRViveHand __instance)
{
if (((Object)((Component)__instance).gameObject).name.Contains("AnimatedPoint"))
{
AnimLogger.Log("Preventing fake hand from awaking");
return false;
}
return true;
}
[HarmonyPatch(typeof(FVRViveHand), "Start")]
[HarmonyPrefix]
public static bool PreventStart(FVRViveHand __instance)
{
if (((Object)((Component)__instance).gameObject).name.Contains("AnimatedPoint"))
{
AnimLogger.Log("Preventing fake hand from starting");
return false;
}
return true;
}
[HarmonyPatch(typeof(FVRPhysicalObject), "FVRFixedUpdate")]
[HarmonyPrefix]
public static bool PreventUpdate(FVRPhysicalObject __instance)
{
if (((FVRInteractiveObject)__instance).IsHeld && ((object)((FVRInteractiveObject)__instance).m_hand).Equals((object?)((FVRInteractiveObject)__instance).m_hand.OtherHand))
{
return false;
}
return true;
}
[HarmonyPatch(typeof(FVRFireArm), "FVRFixedUpdate")]
[HarmonyPrefix]
public static bool PreventFirearmUpdate(FVRFireArm __instance)
{
if (((FVRInteractiveObject)__instance).IsHeld && ((object)((FVRInteractiveObject)__instance).m_hand).Equals((object?)((FVRInteractiveObject)__instance).m_hand.OtherHand))
{
return false;
}
return true;
}
[HarmonyPatch(typeof(FVRFireArm), "IsTwoHandStabilized")]
[HarmonyPrefix]
public static bool PreventTwoHand(FVRFireArm __instance, ref bool __result)
{
if (((FVRInteractiveObject)__instance).IsHeld && ((object)((FVRInteractiveObject)__instance).m_hand).Equals((object?)((FVRInteractiveObject)__instance).m_hand.OtherHand))
{
__result = false;
return false;
}
return true;
}
[HarmonyPatch(typeof(FVRFireArm), "IsShoulderStabilized")]
[HarmonyPrefix]
public static bool PreventShoulder(FVRFireArm __instance, ref bool __result)
{
if (((FVRInteractiveObject)__instance).IsHeld && ((object)((FVRInteractiveObject)__instance).m_hand).Equals((object?)((FVRInteractiveObject)__instance).m_hand.OtherHand))
{
__result = false;
return false;
}
return true;
}
}
public class AnimatedPoint : PathSlidingPoint
{
public FVRPhysicalObject interactable;
public bool isPaused = false;
public Vector3 prevVector = Vector3.zero;
public Quaternion prevRotation = Quaternion.identity;
public float prevPosition = 0f;
public bool changedPathSegment;
public List<EventPoint> activeEvents = new List<EventPoint>();
public FVRViveHand fakeHand;
public override void Awake()
{
base.Awake();
CreateFakeHand();
}
public override void Update()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
if ((Object)(object)from == (Object)null || (Object)(object)to == (Object)null)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
CheckForRelease();
CheckForMove();
if ((Object)(object)activeHand != (Object)null)
{
UpdatePosition();
Gizmos.Sphere(((Component)this).transform.position, 0.005f, (Color?)Color.grey, false, 16);
}
if (IsHeldByFakeHand())
{
((FVRInteractiveObject)interactable).UpdateInteraction(fakeHand);
}
Animate();
UpdateHandMovement();
HandleEvents();
DrawGizmos();
prevVector = ((Component)this).transform.position;
prevRotation = ((Component)this).transform.rotation;
prevPosition = position;
}
private void UpdateHandMovement()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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_0028: 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_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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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)
Vector3 val = (((Component)this).transform.position - prevVector) / Time.deltaTime;
Quaternion val2 = ((Component)this).transform.rotation * Quaternion.Inverse(prevRotation);
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor(Mathf.DeltaAngle(0f, ((Quaternion)(ref val2)).eulerAngles.x), Mathf.DeltaAngle(0f, ((Quaternion)(ref val2)).eulerAngles.y), Mathf.DeltaAngle(0f, ((Quaternion)(ref val2)).eulerAngles.z));
Vector3 val4 = val3;
fakeHand.Input.VelLinearLocal = val;
fakeHand.Input.VelLinearWorld = val;
fakeHand.Input.VelAngularLocal = val4;
fakeHand.Input.VelAngularWorld = val4;
}
private void CreateFakeHand()
{
//IL_0019: 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_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)
fakeHand = ((Component)this).gameObject.AddComponent<FVRViveHand>();
fakeHand.m_initState = (HandInitializationState)0;
fakeHand.IsInDemoMode = true;
fakeHand.Input = default(HandInput);
fakeHand.Buzzer = ((Component)this).gameObject.AddComponent<FVRHaptics>();
fakeHand.OtherHand = fakeHand;
}
public void SetInteractable(FVRPhysicalObject physObj)
{
interactable = physObj;
((FVRInteractiveObject)interactable).m_hand = fakeHand;
((FVRInteractiveObject)interactable).IsHeld = true;
}
protected void Animate()
{
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: 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_01f0: 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)
changedPathSegment = false;
if ((Object)(object)activeHand == (Object)null && position >= 1f)
{
PathAnchor nextPoint = path.GetNextPoint(to);
position = 0f;
if (!((object)to).Equals((object?)nextPoint))
{
ShiftEndpointsForwards(nextPoint);
}
else
{
from = path.points[0];
to = path.points[1];
changedPathSegment = true;
}
}
if (from.isJumpPoint)
{
position = 1f;
}
((Component)this).transform.position = path.GetLerpPosition(from, to, position) + offset;
((Component)this).transform.rotation = path.GetLerpRotation(from, to, position);
if (!isPaused && (Object)(object)activeHand == (Object)null)
{
position += Mathf.Lerp(from.speedPoint.value, to.speedPoint.value, position) * Time.deltaTime / path.GetDistanceBetweenPoints(from, to);
}
if (!IsHeldByFakeHand() || (Object)(object)((Component)interactable).transform.parent != (Object)null)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
return;
}
interactable.RootRigidbody.velocity = Vector3.zero;
((Component)interactable).transform.position = ((Component)this).transform.position - offset;
((Component)interactable).transform.rotation = ((Component)this).transform.rotation;
}
protected void HandleEvents()
{
if (changedPathSegment)
{
AnimLogger.Log("Skipping because from changed");
return;
}
foreach (EventPoint events in from.eventsList)
{
if (prevPosition < events.position && position > events.position)
{
events.HandleEventForward(this);
}
else if (prevPosition > events.position && position < events.position)
{
events.HandleEventBackward(this);
}
}
foreach (EventEndPoint eventEnd in from.eventEndList)
{
if (prevPosition < eventEnd.position && position > eventEnd.position)
{
eventEnd.other.HandleEndpointEventForward(this);
}
else if (prevPosition > eventEnd.position && position < eventEnd.position)
{
eventEnd.other.HandleEndpointEventBackward(this);
}
}
}
protected override void ShiftEndpointsForwards(PathAnchor next)
{
base.ShiftEndpointsForwards(next);
changedPathSegment = true;
}
protected override void ShiftEndpointsBackwards(PathAnchor prev)
{
base.ShiftEndpointsBackwards(prev);
changedPathSegment = true;
}
public bool IsHeldByFakeHand()
{
return (Object)(object)interactable != (Object)null && ((object)((FVRInteractiveObject)interactable).m_hand).Equals((object?)fakeHand);
}
private void OnDestroy()
{
if (IsHeldByFakeHand())
{
((FVRInteractiveObject)interactable).IsHeld = false;
((FVRInteractiveObject)interactable).m_hand = null;
}
foreach (EventPoint activeEvent in activeEvents)
{
activeEvent.trackedAnimations.Remove(this);
}
path.animations.Remove(this);
}
}
public class ClickablePoint : MonoBehaviour
{
public Color pointColor = Color.red;
public float radius = 0.01f;
public bool drawGizmos = true;
public bool drawInteractionSphere = true;
public GameObject buttonPoint;
public FVRViveHand activeHand = null;
protected float savedDist;
public virtual void Awake()
{
//IL_003b: 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_0050: Expected O, but got Unknown
//IL_0071: 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_00b0: 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Expected O, but got Unknown
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
((Component)this).gameObject.layer = LayerMask.NameToLayer("Interactable");
Canvas val = ((Component)this).gameObject.AddComponent<Canvas>();
RectTransform component = ((Component)val).GetComponent<RectTransform>();
val.renderMode = (RenderMode)2;
component.sizeDelta = new Vector2(1f, 1f);
buttonPoint = new GameObject();
buttonPoint.transform.SetParent(((Component)this).transform);
buttonPoint.transform.localPosition = Vector3.zero;
buttonPoint.transform.rotation = ((Component)this).transform.rotation;
buttonPoint.transform.localScale = new Vector3(0.0005f, 0.0005f, 0.0005f);
BoxCollider val2 = buttonPoint.AddComponent<BoxCollider>();
val2.size = new Vector3(50f, 50f, 50f);
((Collider)val2).isTrigger = true;
Button val3 = buttonPoint.AddComponent<Button>();
((UnityEvent)val3.onClick).AddListener(new UnityAction(ButtonPressed));
FVRPointableButton val4 = buttonPoint.AddComponent<FVRPointableButton>();
((MonoBehaviour)val4).useGUILayout = true;
val4.ColorSelected = Color.blue;
val4.ColorUnselected = Color.cyan;
((FVRPointable)val4).MaxPointingRange = 2f;
val4.Button = val3;
}
public virtual void Update()
{
CheckForRelease();
DrawGizmos();
}
public void CheckForRelease()
{
if ((Object)(object)activeHand != (Object)null && activeHand.Input.TriggerFloat < 0.2f)
{
ButtonReleased();
}
}
public virtual void ButtonPressed()
{
//IL_002f: 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)
if (!((Object)(object)activeHand != (Object)null))
{
activeHand = AnimationUtils.GetPointingHand();
savedDist = Vector3.Distance(activeHand.PointingTransform.position, ((Component)this).transform.position);
}
}
public virtual void ButtonReleased()
{
activeHand = null;
}
public virtual void DrawGizmos()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (drawGizmos && drawInteractionSphere)
{
Gizmos.Sphere(((Component)this).transform.position, radius, (Color?)pointColor, false, 16);
}
}
}
public class EventEndPoint : PathSlidingPoint
{
public EventPoint other;
protected override void ShiftEndpointsForwards(PathAnchor next)
{
from.eventEndList.Remove(this);
base.ShiftEndpointsForwards(next);
from.eventEndList.Add(this);
}
protected override void ShiftEndpointsBackwards(PathAnchor prev)
{
from.eventEndList.Remove(this);
base.ShiftEndpointsBackwards(prev);
from.eventEndList.Add(this);
}
public void OnDestroy()
{
if ((Object)(object)from != (Object)null)
{
from.eventEndList.Remove(this);
}
}
}
public class EventPoint : PathSlidingPoint
{
public List<UnityAction<AnimatedPoint>> enterEvents = new List<UnityAction<AnimatedPoint>>();
public List<UnityAction<AnimatedPoint>> stayEvents = new List<UnityAction<AnimatedPoint>>();
public List<UnityAction<AnimatedPoint>> exitEvents = new List<UnityAction<AnimatedPoint>>();
public GameObject textObject;
public Text eventText;
public bool isOptionExpanded;
public List<OptionPoint> optionList = new List<OptionPoint>();
public EventEndPoint endPoint;
public List<AnimatedPoint> trackedAnimations = new List<AnimatedPoint>();
public override void Awake()
{
base.Awake();
CreateOptions();
AddEventText();
}
public override void Update()
{
base.Update();
if (drawGizmos)
{
UpdateOptionPosition();
UpdateEventText();
}
HandleRangedEvents();
}
public override void DrawGizmos()
{
//IL_002f: 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_0045: Unknown result type (might be due to invalid IL or missing references)
if (drawGizmos)
{
base.DrawGizmos();
if ((Object)(object)endPoint != (Object)null)
{
Gizmos.Line(((Component)this).transform.position, ((Component)endPoint).transform.position, (Color?)pointColor, false);
}
}
}
protected void UpdateOptionPosition()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_003d: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < optionList.Count; i++)
{
((Component)optionList[i]).transform.position = ((Component)this).transform.position + Vector3.down * 0.03f * (float)(i + 1);
}
}
protected void UpdateEventText()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
textObject.transform.rotation = Quaternion.LookRotation(textObject.transform.position - GM.CurrentPlayerBody.Head.position);
textObject.transform.position = ((Component)this).transform.position + Vector3.up * 0.03f;
}
protected void HandleRangedEvents()
{
if (!((Object)(object)endPoint != (Object)null))
{
return;
}
foreach (AnimatedPoint trackedAnimation in trackedAnimations)
{
if (!trackedAnimation.IsHeldByFakeHand())
{
continue;
}
foreach (UnityAction<AnimatedPoint> stayEvent in stayEvents)
{
stayEvent.Invoke(trackedAnimation);
}
}
}
public void SetRanged()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)endPoint == (Object)null)
{
GameObject val = new GameObject("OtherPoint");
val.transform.position = ((Component)this).transform.position;
endPoint = val.AddComponent<EventEndPoint>();
endPoint.pointColor = new Color(0.39607844f, 16f / 85f, 22f / 51f, 1f);
endPoint.radius = 0.004f;
endPoint.path = path;
endPoint.from = from;
endPoint.to = path.GetNextPoint(to);
endPoint.position = position + (1f - position) / 2f;
endPoint.other = this;
from.eventEndList.Add(endPoint);
}
}
public void SetPoint()
{
if ((Object)(object)endPoint != (Object)null)
{
endPoint.from.eventEndList.Remove(endPoint);
Object.Destroy((Object)(object)((Component)endPoint).gameObject);
endPoint = null;
}
}
public void ClearEvents()
{
enterEvents.Clear();
stayEvents.Clear();
exitEvents.Clear();
}
private void AddEventText()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_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)
//IL_0062: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
textObject = new GameObject();
textObject.transform.SetParent(((Component)this).transform);
textObject.transform.position = ((Component)this).transform.position + Vector3.up * 0.03f;
textObject.transform.rotation = ((Component)this).transform.rotation;
textObject.transform.localScale = new Vector3(0.0005f, 0.0005f, 0.0005f);
eventText = textObject.AddComponent<Text>();
eventText.font = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf");
eventText.alignment = (TextAnchor)4;
eventText.horizontalOverflow = (HorizontalWrapMode)1;
eventText.verticalOverflow = (VerticalWrapMode)1;
eventText.fontSize = 16;
eventText.text = "Select An Event";
}
private void CreateOptions()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
GameObject val = new GameObject("OptionPoint");
val.transform.SetParent(((Component)this).transform);
val.transform.position = ((Component)this).transform.position + Vector3.down * 0.03f;
optionList.Add(val.AddComponent<OptionPoint>());
optionList[0].optionText.text = "+";
optionList[0].clickEvent = new UnityAction(ExpandOptions);
}
private void ClearOptions()
{
foreach (OptionPoint option in optionList)
{
Object.Destroy((Object)(object)((Component)option).gameObject);
}
optionList.Clear();
}
private void ExpandOptions()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
ClearOptions();
AddEventOption("-", new UnityAction(HideOptions));
AddEventOption("Firearm Events >", new UnityAction(ShowFirearmEventOptions));
AddEventOption("Physics Events >", new UnityAction(ShowPhysicsEventOptions));
AddEventOption("Animation Events >", new UnityAction(ShowAnimationEventOptions));
AddEventOption("Interaction Events >", new UnityAction(ShowInteractionEventOptions));
AddEventOption("Delete Event", (UnityAction)delegate
{
Object.Destroy((Object)(object)((Component)this).gameObject);
});
}
private void HideOptions()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
ClearOptions();
AddEventOption("+", new UnityAction(ExpandOptions));
}
private void ShowFirearmEventOptions()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
ClearOptions();
AddEventOption("<", new UnityAction(ExpandOptions));
AddEventOption("Set Fire Gun", (UnityAction)delegate
{
eventText.text = "Fire Gun";
ClearEvents();
enterEvents.Add(FirearmEvents.FireGun);
SetPoint();
});
AddEventOption("Set Drop Magazine", (UnityAction)delegate
{
eventText.text = "Drop Magazine";
ClearEvents();
enterEvents.Add(FirearmEvents.ReleaseMagazine);
SetPoint();
});
AddEventOption("Set Rack Slide", (UnityAction)delegate
{
eventText.text = "Rack Slide";
ClearEvents();
enterEvents.Add(FirearmEvents.RackSlide);
SetPoint();
});
}
private void ShowPhysicsEventOptions()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
ClearOptions();
AddEventOption("<", new UnityAction(ExpandOptions));
AddEventOption("Set Drop Item", (UnityAction)delegate
{
eventText.text = "Drop Item";
ClearEvents();
enterEvents.Add(PhysicalObjectEvents.DropItem);
SetPoint();
});
AddEventOption("Set Throw Item", (UnityAction)delegate
{
eventText.text = "Throw Item";
ClearEvents();
enterEvents.Add(PhysicalObjectEvents.DropItemWithVelocity);
SetPoint();
});
}
private void ShowInteractionEventOptions()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Expected O, but got Unknown
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
ClearOptions();
AddEventOption("<", new UnityAction(ExpandOptions));
AddEventOption("Set Touchpad Up", (UnityAction)delegate
{
eventText.text = "Touchpad Up";
ClearEvents();
enterEvents.Add(delegate(AnimatedPoint o)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
InteractionEvents.TouchpadPressed(o, Vector2.up);
});
SetPoint();
});
AddEventOption("Set Touchpad Down", (UnityAction)delegate
{
eventText.text = "Touchpad Down";
ClearEvents();
enterEvents.Add(delegate(AnimatedPoint o)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
InteractionEvents.TouchpadPressed(o, Vector2.down);
});
SetPoint();
});
AddEventOption("Set Touchpad Left", (UnityAction)delegate
{
eventText.text = "Touchpad Left";
ClearEvents();
enterEvents.Add(delegate(AnimatedPoint o)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
InteractionEvents.TouchpadPressed(o, Vector2.left);
});
SetPoint();
});
AddEventOption("Set Touchpad Right", (UnityAction)delegate
{
eventText.text = "Touchpad Right";
ClearEvents();
enterEvents.Add(delegate(AnimatedPoint o)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
InteractionEvents.TouchpadPressed(o, Vector2.right);
});
SetPoint();
});
AddEventOption("Set Trigger Pull", (UnityAction)delegate
{
eventText.text = "Trigger Pull";
ClearEvents();
enterEvents.Add(InteractionEvents.PullTrigger);
SetPoint();
});
AddEventOption("Set Hold Touchpad Up", (UnityAction)delegate
{
eventText.text = "Hold Touchpad Up";
ClearEvents();
enterEvents.Add(delegate(AnimatedPoint o)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
InteractionEvents.TouchpadHold(o, Vector2.up);
});
exitEvents.Add(InteractionEvents.TouchpadRelease);
SetRanged();
});
AddEventOption("Set Hold Touchpad Down", (UnityAction)delegate
{
eventText.text = "Hold Touchpad Down";
ClearEvents();
enterEvents.Add(delegate(AnimatedPoint o)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
InteractionEvents.TouchpadHold(o, Vector2.down);
});
exitEvents.Add(InteractionEvents.TouchpadRelease);
SetRanged();
});
AddEventOption("Set Hold Touchpad Left", (UnityAction)delegate
{
eventText.text = "Hold Touchpad Left";
ClearEvents();
enterEvents.Add(delegate(AnimatedPoint o)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
InteractionEvents.TouchpadHold(o, Vector2.left);
});
exitEvents.Add(InteractionEvents.TouchpadRelease);
SetRanged();
});
AddEventOption("Set Hold Touchpad Right", (UnityAction)delegate
{
eventText.text = "Hold Touchpad Right";
ClearEvents();
enterEvents.Add(delegate(AnimatedPoint o)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
InteractionEvents.TouchpadHold(o, Vector2.right);
});
exitEvents.Add(InteractionEvents.TouchpadRelease);
SetRanged();
});
AddEventOption("Set Trigger Hold", (UnityAction)delegate
{
eventText.text = "Trigger Hold";
ClearEvents();
enterEvents.Add(InteractionEvents.HoldTrigger);
exitEvents.Add(InteractionEvents.ReleaseTrigger);
SetRanged();
});
}
private void ShowAnimationEventOptions()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
ClearOptions();
AddEventOption("<", new UnityAction(ExpandOptions));
AddEventOption("Duplicate Animation Events >", new UnityAction(ShowDuplicateEventOptions));
AddEventOption("Move Animation Events >", new UnityAction(ShowMoveEventOptions));
}
private void ShowDuplicateEventOptions()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
ClearOptions();
AddEventOption("<", new UnityAction(ShowAnimationEventOptions));
foreach (AnimationPath path in H3VRAnimator.SpectatorPanel.paths)
{
AddEventOption("Duplicate To Path : " + path.pathName, (UnityAction)delegate
{
eventText.text = "Duplicate To Path : " + path.pathName;
enterEvents.Clear();
enterEvents.Add(delegate(AnimatedPoint o)
{
AnimationEvents.DuplicateToPath(o, path);
});
SetPoint();
});
}
}
private void ShowMoveEventOptions()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
ClearOptions();
AddEventOption("<", new UnityAction(ShowAnimationEventOptions));
foreach (AnimationPath path in H3VRAnimator.SpectatorPanel.paths)
{
AddEventOption("Move To Path : " + path.pathName, (UnityAction)delegate
{
eventText.text = "Move To Path : " + path.pathName;
enterEvents.Clear();
enterEvents.Add(delegate(AnimatedPoint o)
{
AnimationEvents.MoveToPath(o, path);
});
SetPoint();
});
}
}
private OptionPoint AddEventOption(string optionText, UnityAction onClick)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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)
GameObject val = new GameObject(optionText);
val.transform.SetParent(((Component)this).transform);
val.transform.position = ((Component)this).transform.position + Vector3.down * 0.03f * (float)(optionList.Count + 1);
OptionPoint optionPoint = val.AddComponent<OptionPoint>();
optionPoint.optionText.text = optionText;
optionPoint.clickEvent = onClick;
optionList.Add(optionPoint);
return optionPoint;
}
public void SetGizmosEnabled(bool enabled)
{
drawGizmos = enabled;
buttonPoint.SetActive(drawGizmos);
textObject.SetActive(drawGizmos);
foreach (OptionPoint option in optionList)
{
option.drawGizmos = drawGizmos;
option.buttonPoint.SetActive(drawGizmos);
}
}
protected override void ShiftEndpointsForwards(PathAnchor next)
{
from.eventsList.Remove(this);
base.ShiftEndpointsForwards(next);
from.eventsList.Add(this);
}
protected override void ShiftEndpointsBackwards(PathAnchor prev)
{
from.eventsList.Remove(this);
base.ShiftEndpointsBackwards(prev);
from.eventsList.Add(this);
}
public virtual void HandleEventForward(AnimatedPoint eventTarget)
{
if ((Object)(object)endPoint != (Object)null)
{
AnimLogger.Log("Handling event forwards, Adding to event, event count: " + trackedAnimations.Count + ", Prev pos: " + eventTarget.prevPosition + ", Pos: " + eventTarget.position);
trackedAnimations.Add(eventTarget);
eventTarget.activeEvents.Add(this);
}
foreach (UnityAction<AnimatedPoint> enterEvent in enterEvents)
{
enterEvent.Invoke(eventTarget);
}
}
public virtual void HandleEventBackward(AnimatedPoint eventTarget)
{
if (!((Object)(object)endPoint != (Object)null))
{
return;
}
AnimLogger.Log("Handling event backwards, removing event, event count: " + trackedAnimations.Count + ", Prev pos: " + eventTarget.prevPosition + ", Pos: " + eventTarget.position);
trackedAnimations.Remove(eventTarget);
eventTarget.activeEvents.Remove(this);
foreach (UnityAction<AnimatedPoint> exitEvent in exitEvents)
{
exitEvent.Invoke(eventTarget);
}
}
public virtual void HandleEndpointEventForward(AnimatedPoint eventTarget)
{
if (!((Object)(object)endPoint != (Object)null))
{
return;
}
AnimLogger.Log("Handling endpoint forwards, Removing from event, event count: " + trackedAnimations.Count + ", Prev pos: " + eventTarget.prevPosition + ", Pos: " + eventTarget.position);
trackedAnimations.Remove(eventTarget);
eventTarget.activeEvents.Remove(this);
foreach (UnityAction<AnimatedPoint> exitEvent in exitEvents)
{
exitEvent.Invoke(eventTarget);
}
}
public virtual void HandleEndpointEventBackward(AnimatedPoint eventTarget)
{
if (!((Object)(object)endPoint != (Object)null))
{
return;
}
AnimLogger.Log("Handling endpoint backwards, Adding to event, event count: " + trackedAnimations.Count + ", Prev pos: " + eventTarget.prevPosition + ", Pos: " + eventTarget.position);
trackedAnimations.Add(eventTarget);
eventTarget.activeEvents.Add(this);
foreach (UnityAction<AnimatedPoint> enterEvent in enterEvents)
{
enterEvent.Invoke(eventTarget);
}
}
public void OnDestroy()
{
Object.Destroy((Object)(object)textObject);
foreach (OptionPoint option in optionList)
{
Object.Destroy((Object)(object)((Component)option).gameObject);
}
if ((Object)(object)endPoint != (Object)null)
{
Object.Destroy((Object)(object)((Component)endPoint).gameObject);
}
if ((Object)(object)from != (Object)null)
{
from.eventsList.Remove(this);
}
}
}
public class MovablePoint : ClickablePoint
{
public bool lockPosition = false;
public bool lockRotation = false;
public override void Update()
{
CheckForMove();
base.Update();
}
public virtual void CheckForMove()
{
//IL_0030: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)activeHand != (Object)null)
{
if (!lockPosition)
{
((Component)this).transform.position = activeHand.PointingTransform.position + activeHand.PointingTransform.forward * savedDist;
}
if (!lockRotation)
{
((Component)this).transform.rotation = activeHand.PointingTransform.rotation;
}
}
}
}
public class OptionPoint : ClickablePoint
{
public UnityAction clickEvent;
public Text optionText;
public override void Awake()
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
drawInteractionSphere = false;
base.Awake();
optionText = buttonPoint.AddComponent<Text>();
optionText.font = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf");
optionText.alignment = (TextAnchor)4;
optionText.horizontalOverflow = (HorizontalWrapMode)1;
optionText.verticalOverflow = (VerticalWrapMode)1;
optionText.fontSize = 20;
optionText.text = "Example Text";
}
public override void Update()
{
//IL_001f: 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_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)
base.Update();
if (drawGizmos)
{
((Component)this).transform.rotation = Quaternion.LookRotation(((Component)this).transform.position - GM.CurrentPlayerBody.Head.position);
}
}
public override void ButtonPressed()
{
base.ButtonPressed();
clickEvent.Invoke();
}
}
public class PathAnchor : MovablePoint
{
public AnimationPath path;
public RotationPoint rotationPoint;
public ValueSlidingPoint speedPoint;
public PositionControlPoint forwardPoint;
public PositionControlPoint backPoint;
public RotationControlPoint forwardRotationPoint;
public RotationControlPoint backRotationPoint;
public OptionPoint optionPoint;
public List<OptionPoint> optionList = new List<OptionPoint>();
public List<EventPoint> eventsList = new List<EventPoint>();
public List<EventEndPoint> eventEndList = new List<EventEndPoint>();
public bool isJumpPoint = false;
private bool isOptionExpanded = false;
public override void Awake()
{
base.Awake();
lockRotation = true;
CreateRotationPoint();
CreateSpeedPoint();
CreatePositionControlPoints();
CreateRotationControlPoints();
CreateOptions();
}
public override void Update()
{
//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_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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//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_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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
((Component)rotationPoint).transform.position = ((Component)this).transform.position + Vector3.up * 0.12f;
((Component)speedPoint).transform.rotation = Quaternion.identity;
((Component)speedPoint).transform.position = ((Component)this).transform.position + Vector3.up * 0.06f;
speedPoint.RotateToPlayer();
((Component)forwardRotationPoint).transform.position = ((Component)forwardPoint).transform.position + Vector3.up * 0.03f;
((Component)backRotationPoint).transform.position = ((Component)backPoint).transform.position + Vector3.up * 0.03f;
((Component)optionPoint).transform.position = ((Component)this).transform.position + Vector3.down * 0.03f;
for (int i = 0; i < optionList.Count; i++)
{
((Component)optionList[i]).transform.position = ((Component)this).transform.position + Vector3.down * 0.03f * (float)(i + 2);
}
base.Update();
}
private void CreateRotationPoint()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("RotationPoint");
val.transform.SetParent(((Component)this).transform);
val.transform.position = ((Component)this).transform.position + Vector3.up * 0.12f;
rotationPoint = val.AddComponent<RotationPoint>();
rotationPoint.pointColor = Color.cyan;
}
private void CreateSpeedPoint()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("SpeedPoint");
val.transform.SetParent(((Component)this).transform);
val.transform.position = ((Component)this).transform.position + Vector3.up * 0.06f;
speedPoint = val.AddComponent<ValueSlidingPoint>();
speedPoint.pointColor = Color.yellow;
speedPoint.maxDown = 0.03f;
speedPoint.maxUp = 0.03f;
speedPoint.maxValue = float.MaxValue;
speedPoint.minValue = 0f;
speedPoint.multiplier = 0.25f;
speedPoint.SetValue(0.3f);
}
private void CreatePositionControlPoints()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0029: 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_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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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)
GameObject val = new GameObject("ForwardPoint");
val.transform.SetParent(((Component)this).transform);
val.transform.position = ((Component)this).transform.position + ((Component)this).transform.forward * 0.06f;
forwardPoint = val.AddComponent<PositionControlPoint>();
forwardPoint.pointColor = Color.grey;
forwardPoint.radius = 0.005f;
GameObject val2 = new GameObject("BackwardPoint");
val2.transform.SetParent(((Component)this).transform);
val2.transform.position = ((Component)this).transform.position - ((Component)this).transform.forward * 0.06f;
backPoint = val2.AddComponent<PositionControlPoint>();
backPoint.pointColor = Color.grey;
backPoint.radius = 0.005f;
backPoint.other = forwardPoint;
forwardPoint.other = backPoint;
}
private void CreateRotationControlPoints()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0029: 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_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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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)
GameObject val = new GameObject("ForwardRotationPoint");
val.transform.SetParent(((Component)this).transform);
val.transform.position = ((Component)this).transform.position - ((Component)this).transform.forward * 0.06f;
forwardRotationPoint = val.AddComponent<RotationControlPoint>();
forwardRotationPoint.pointColor = Color.cyan;
forwardRotationPoint.radius = 0.005f;
GameObject val2 = new GameObject("BackRotationPoint");
val2.transform.SetParent(((Component)this).transform);
val2.transform.position = ((Component)this).transform.position - ((Component)this).transform.forward * 0.06f;
backRotationPoint = val2.AddComponent<RotationControlPoint>();
backRotationPoint.pointColor = Color.cyan;
backRotationPoint.radius = 0.005f;
forwardRotationPoint.other = backRotationPoint;
backRotationPoint.other = forwardRotationPoint;
forwardRotationPoint.referenceTransform = ((Component)rotationPoint).transform;
backRotationPoint.referenceTransform = ((Component)rotationPoint).transform;
}
private void CreateOptions()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
GameObject val = new GameObject("OptionPoint");
val.transform.SetParent(((Component)this).transform);
val.transform.position = ((Component)this).transform.position + Vector3.up * 0.03f;
optionPoint = val.AddComponent<OptionPoint>();
optionPoint.optionText.text = "+";
optionPoint.clickEvent = new UnityAction(ToggleShowOptions);
}
private void ToggleShowOptions()
{
isOptionExpanded = !isOptionExpanded;
if (isOptionExpanded)
{
ExpandOptions();
}
else
{
HideOptions();
}
}
private void ExpandOptions()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: 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_0098: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected O, but got Unknown
//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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Expected O, but got Unknown
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Expected O, but got Unknown
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: 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_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Expected O, but got Unknown
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Expected O, but got Unknown
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Expected O, but got Unknown
this.optionPoint.optionText.text = "-";
GameObject val = new GameObject("Add");
val.transform.SetParent(((Component)this).transform);
val.transform.position = ((Component)this).transform.position + Vector3.down * 0.03f * (float)(optionList.Count + 2);
OptionPoint optionPoint = val.AddComponent<OptionPoint>();
optionPoint.optionText.text = "Add";
optionPoint.clickEvent = (UnityAction)delegate
{
path.InsertPointAfter(this);
};
optionList.Add(optionPoint);
GameObject val2 = new GameObject("Delete");
val2.transform.SetParent(((Component)this).transform);
val2.transform.position = ((Component)this).transform.position + Vector3.down * 0.03f * (float)(optionList.Count + 2);
OptionPoint optionPoint2 = val2.AddComponent<OptionPoint>();
optionPoint2.optionText.text = "Delete";
optionPoint2.clickEvent = (UnityAction)delegate
{
path.DeletePoint(this);
};
optionList.Add(optionPoint2);
GameObject val3 = new GameObject("ToggleJump");
val3.transform.SetParent(((Component)this).transform);
val3.transform.position = ((Component)this).transform.position + Vector3.down * 0.03f * (float)(optionList.Count + 2);
OptionPoint optionPoint3 = val3.AddComponent<OptionPoint>();
optionPoint3.optionText.text = "Toggle Jump";
optionPoint3.clickEvent = new UnityAction(ToggleJump);
optionList.Add(optionPoint3);
GameObject val4 = new GameObject("AddEvent");
val4.transform.SetParent(((Component)this).transform);
val4.transform.position = ((Component)this).transform.position + Vector3.down * 0.03f * (float)(optionList.Count + 2);
OptionPoint optionPoint4 = val4.AddComponent<OptionPoint>();
optionPoint4.optionText.text = "Add Event";
optionPoint4.clickEvent = new UnityAction(AddEventPoint);
optionList.Add(optionPoint4);
}
private void HideOptions()
{
optionPoint.optionText.text = "+";
for (int i = 0; i < optionList.Count; i++)
{
Object.Destroy((Object)(object)((Component)optionList[i]).gameObject);
}
optionList.Clear();
}
private void AddEventPoint()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0018: 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)
GameObject val = new GameObject("EventPoint");
val.transform.position = ((Component)this).transform.position;
EventPoint eventPoint = val.AddComponent<EventPoint>();
eventPoint.pointColor = new Color(0.8509804f, 0f, 1f, 1f);
eventPoint.radius = 0.005f;
eventPoint.path = path;
eventPoint.from = this;
eventPoint.to = path.GetNextPoint(this);
eventPoint.position = 0.5f;
eventsList.Add(eventPoint);
}
private void ToggleJump()
{
isJumpPoint = !isJumpPoint;
}
public void SetGizmosEnabled(bool enabled)
{
drawGizmos = enabled;
rotationPoint.drawGizmos = drawGizmos;
speedPoint.drawGizmos = drawGizmos;
optionPoint.drawGizmos = drawGizmos;
forwardPoint.drawGizmos = drawGizmos;
backPoint.drawGizmos = drawGizmos;
forwardRotationPoint.drawGizmos = drawGizmos;
backRotationPoint.drawGizmos = drawGizmos;
buttonPoint.SetActive(drawGizmos);
rotationPoint.buttonPoint.SetActive(drawGizmos);
speedPoint.buttonPoint.SetActive(drawGizmos);
((Component)optionPoint).gameObject.SetActive(drawGizmos);
forwardPoint.buttonPoint.SetActive(drawGizmos);
backPoint.buttonPoint.SetActive(drawGizmos);
forwardRotationPoint.buttonPoint.SetActive(drawGizmos);
backRotationPoint.buttonPoint.SetActive(drawGizmos);
foreach (OptionPoint option in optionList)
{
option.drawGizmos = drawGizmos;
option.buttonPoint.gameObject.SetActive(drawGizmos);
}
foreach (EventPoint events in eventsList)
{
events.SetGizmosEnabled(enabled);
}
}
public void OnDestroy()
{
Object.Destroy((Object)(object)((Component)rotationPoint).gameObject);
Object.Destroy((Object)(object)((Component)speedPoint).gameObject);
Object.Destroy((Object)(object)((Component)forwardPoint).gameObject);
Object.Destroy((Object)(object)((Component)backPoint).gameObject);
Object.Destroy((Object)(object)((Component)forwardRotationPoint).gameObject);
Object.Destroy((Object)(object)((Component)backRotationPoint).gameObject);
Object.Destroy((Object)(object)((Component)optionPoint).gameObject);
foreach (OptionPoint option in optionList)
{
Object.Destroy((Object)(object)((Component)option).gameObject);
}
foreach (EventPoint events in eventsList)
{
Object.Destroy((Object)(object)((Component)events).gameObject);
}
}
}
public class PathSlidingPoint : MovablePoint
{
public AnimationPath path;
public PathAnchor from;
public PathAnchor to;
public float position;
public Vector3 offset = Vector3.zero;
public override void Update()
{
//IL_0093: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)from == (Object)null || (Object)(object)to == (Object)null)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
CheckForRelease();
CheckForMove();
if ((Object)(object)activeHand != (Object)null)
{
UpdatePosition();
Gizmos.Sphere(((Component)this).transform.position, 0.005f, (Color?)Color.grey, false, 16);
}
((Component)this).transform.position = path.GetLerpPosition(from, to, position) + offset;
DrawGizmos();
}
protected void UpdatePosition()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
position = path.GetClosestPoint(from, to, ((Component)this).transform.position);
UpdateEndpoints();
}
protected virtual void UpdateEndpoints()
{
if (position >= 1f)
{
PathAnchor nextPoint = path.GetNextPoint(to);
if (!((object)nextPoint).Equals((object?)to))
{
ShiftEndpointsForwards(nextPoint);
}
}
else if (position <= 0f)
{
PathAnchor prevPoint = path.GetPrevPoint(from);
if (!((object)prevPoint).Equals((object?)from))
{
ShiftEndpointsBackwards(prevPoint);
}
}
}
protected virtual void ShiftEndpointsForwards(PathAnchor next)
{
from = to;
to = next;
position = 0f;
}
protected virtual void ShiftEndpointsBackwards(PathAnchor prev)
{
to = from;
from = prev;
position = 1f;
}
}
public class PositionControlPoint : MovablePoint
{
public PositionControlPoint other;
public override void Update()
{
if ((Object)(object)other.activeHand == (Object)null)
{
base.Update();
if ((Object)(object)activeHand != (Object)null && ((Component)other).gameObject.activeSelf)
{
PositionOtherPoint();
}
}
else
{
DrawGizmos();
}
}
public override void DrawGizmos()
{
//IL_001d: 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)
if (drawGizmos)
{
base.DrawGizmos();
Gizmos.Line(((Component)this).transform.position, ((Component)this).transform.parent.position, (Color?)pointColor, false);
}
}
public void PositionOtherPoint()
{
//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_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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invali