using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("OrtonLongGaming")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ca4e1956341ba23deb272ddd09f0b39bb60c007c")]
[assembly: AssemblyProduct("FNAFLevel")]
[assembly: AssemblyTitle("FNAFLevel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace FNAFLevel
{
[BepInPlugin("OrtonLongGaming.FNAFLevel", "FNAFLevel", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class FNAFLevel : BaseUnityPlugin
{
public static Level Level;
public static LevelValuables LevelValuables;
internal static FNAFLevel Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} is loading assets...");
LoadAssets();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded assets!");
RegisterLevel();
RegisterValuables();
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void LoadAssets()
{
string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "fnaflevel.bundle");
AssetBundle val = AssetBundle.LoadFromFile(text);
Level = val.LoadAsset<Level>("assets/FNAF/Level - FNAF.asset");
LevelValuables = val.LoadAsset<LevelValuables>("assets/FNAF/FNAFVALUABLES.asset");
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded assets!");
}
internal void RegisterValuables()
{
List<string> list = new List<string> { "Valuables - FNAF" };
foreach (GameObject item in LevelValuables.tiny)
{
Valuables.RegisterValuable(item, list);
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
}
foreach (GameObject item2 in LevelValuables.small)
{
Valuables.RegisterValuable(item2, list);
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
}
foreach (GameObject item3 in LevelValuables.medium)
{
Valuables.RegisterValuable(item3, list);
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
}
foreach (GameObject item4 in LevelValuables.big)
{
Valuables.RegisterValuable(item4, list);
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
}
foreach (GameObject item5 in LevelValuables.wide)
{
Valuables.RegisterValuable(item5, list);
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
}
foreach (GameObject item6 in LevelValuables.tall)
{
Valuables.RegisterValuable(item6, list);
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
}
foreach (GameObject item7 in LevelValuables.veryTall)
{
Valuables.RegisterValuable(item7, list);
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
}
}
internal void RegisterLevel()
{
Levels.RegisterLevel(Level);
}
internal void Patch()
{
//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_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
public class OfficeDoor : MonoBehaviour
{
[CompilerGenerated]
private sealed class <LateStart>d__20 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public OfficeDoor <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LateStart>d__20(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if (!LevelGenerator.Instance.Generated)
{
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
}
if (SemiFunc.IsMasterClientOrSingleplayer())
{
<>4__this.ActivateDoor();
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public bool Working;
[Space]
public GameObject functionObjects;
public GameObject doorObject;
public Animator doorAnimator;
public GameObject hurtCollider;
public Sound doorCloseSound;
public Sound doorCloseSoundGlobal;
public Sound doorButtonSound;
private PhotonView photonView;
private StaticGrabObject staticGrabObject;
private bool closed = true;
private float timer = 0f;
public List<Renderer> renderers;
public Light doorLight;
private List<Material> sharedMaterials = new List<Material>();
internal List<Material> instancedMaterials = new List<Material>();
private int materialColorField;
private int materialEmissionColorField;
private void Awake()
{
materialColorField = Shader.PropertyToID("_Color");
materialEmissionColorField = Shader.PropertyToID("_EmissionColor");
foreach (Renderer renderer in renderers)
{
Material val = null;
foreach (Material sharedMaterial in sharedMaterials)
{
if (((Object)renderer.sharedMaterials[1]).name == ((Object)sharedMaterial).name)
{
val = sharedMaterial;
renderer.sharedMaterials[1] = instancedMaterials[sharedMaterials.IndexOf(sharedMaterial)];
}
}
if (!Object.op_Implicit((Object)(object)val))
{
val = renderer.sharedMaterials[1];
sharedMaterials.Add(val);
instancedMaterials.Add(renderer.materials[1]);
}
}
}
private void Start()
{
photonView = ((Component)this).GetComponent<PhotonView>();
staticGrabObject = ((Component)this).GetComponent<StaticGrabObject>();
((MonoBehaviour)this).StartCoroutine(LateStart());
}
[IteratorStateMachine(typeof(<LateStart>d__20))]
private IEnumerator LateStart()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LateStart>d__20(0)
{
<>4__this = this
};
}
private void ActivateDoor()
{
if (!SemiFunc.IsMultiplayer())
{
ActivateDoorRPC(Working);
return;
}
photonView.RPC("ActivateDoorRPC", (RpcTarget)0, new object[1] { Working });
}
[PunRPC]
public void ActivateDoorRPC(bool workin)
{
doorObject.SetActive(true);
Working = workin;
}
private void Update()
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
functionObjects.SetActive(Working);
if (timer > 0f)
{
if (closed && timer > 1f)
{
hurtCollider.SetActive(true);
}
else
{
hurtCollider.SetActive(false);
}
timer -= Time.deltaTime;
}
else
{
hurtCollider.SetActive(false);
}
Color val = Color.black;
if (Working)
{
val = (closed ? Color.green : Color.red);
}
if (instancedMaterials.Count > 0)
{
foreach (Material instancedMaterial in instancedMaterials)
{
instancedMaterial.SetColor(materialColorField, val);
instancedMaterial.SetColor(materialEmissionColorField, val);
}
}
if (Object.op_Implicit((Object)(object)doorLight))
{
doorLight.color = val;
}
}
public void ButtonPressed()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && !(timer > 0f))
{
closed = !closed;
if (!SemiFunc.IsMultiplayer())
{
ActionTimeRPC(closed);
return;
}
photonView.RPC("ActionTimeRPC", (RpcTarget)0, new object[1] { closed });
}
}
[PunRPC]
public void ActionTimeRPC(bool shouldClose)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
timer = 1.5f;
closed = shouldClose;
GameDirector.instance.CameraShake.ShakeDistance(8f, 3f, 8f, doorObject.transform.position, 0.5f);
GameDirector.instance.CameraImpact.ShakeDistance(8f, 3f, 12f, doorObject.transform.position, 0.1f);
doorAnimator.SetBool("Closed", closed);
doorCloseSoundGlobal.Play(doorObject.transform.position, 1f, 1f, 1f, 1f);
doorCloseSound.Play(doorObject.transform.position, 1f, 1f, 1f, 1f);
if ((Object)(object)renderers[0] != (Object)null)
{
doorButtonSound.Play(((Component)renderers[0]).transform.position, 1f, 1f, 1f, 1f);
}
}
}
}
namespace FNAFLevel.SpringBones
{
public class SpringBones : MonoBehaviour
{
private enum Axis
{
X,
Y,
Z
}
private class Item
{
private readonly Transform bone;
private readonly Transform parent;
private readonly int axis;
private readonly Vector3 pLookDir;
private readonly Vector3 pSecDir;
private Vector3 wBasePos;
private Vector3 wMassPos;
private Vector3 delta;
private Vector3 speed;
private Vector3 aMain;
private Vector3 aSec;
private Quaternion qrot;
public int deep;
public Item(Transform bone, int axis, float len)
{
//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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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)
this.bone = bone;
parent = bone.parent;
this.axis = axis;
Vector3 val = Vector3.forward;
Vector3 val2 = Vector3.up;
switch (axis)
{
case 0:
val = bone.right;
val2 = bone.up;
break;
case 1:
val = bone.up;
val2 = bone.forward;
break;
case 2:
val = bone.forward;
val2 = bone.right;
break;
}
wBasePos = bone.position + val * len;
wMassPos = wBasePos;
if ((Object)(object)parent != (Object)null)
{
pLookDir = parent.InverseTransformDirection(val);
pSecDir = parent.InverseTransformDirection(val2);
}
else
{
pLookDir = val;
pSecDir = val2;
}
deep = 0;
Transform val3 = bone;
while ((Object)(object)val3.parent != (Object)null)
{
val3 = val3.parent;
deep++;
}
}
public void Tick(float rigid, float damping, float length, float impact)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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_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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: 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)
wBasePos = bone.position + (((Object)(object)parent != (Object)null) ? parent.TransformDirection(pLookDir) : pLookDir) * length;
delta = wBasePos - wMassPos;
if (((Vector3)(ref delta)).sqrMagnitude > length * length)
{
delta = ((Vector3)(ref delta)).normalized * length;
if (length < 0f)
{
delta *= -1f;
}
wMassPos = wBasePos - delta;
}
speed += rigid * Time.deltaTime * delta;
speed *= damping;
wMassPos += speed * Time.deltaTime;
Vector3 val = wMassPos - bone.position;
aMain = ((Vector3)(ref val)).normalized;
if (length < 0f)
{
aMain *= -1f;
}
aSec = (((Object)(object)parent == (Object)null) ? pSecDir : parent.TransformDirection(pSecDir));
qrot = Quaternion.LookRotation(aMain, aSec);
bone.rotation = Quaternion.Lerp(bone.rotation, qrot * QRots[axis], impact);
}
}
private static readonly Quaternion[] QRots = (Quaternion[])(object)new Quaternion[3]
{
new Quaternion(0f, -0.7071f, 0f, 0.7071f),
new Quaternion(0f, 0.7071f, 0.7071f, 0f),
new Quaternion(0f, 0f, 0.7071f, 0.7071f)
};
[SerializeField]
private float length = 1f;
[SerializeField]
private float rigid = 100f;
[SerializeField]
[Range(0f, 1f)]
private float damping = 0.95f;
[SerializeField]
[Range(0f, 1f)]
private float impact = 1f;
[SerializeField]
private Axis axis;
private int iaxis;
[SerializeField]
private List<Transform> bones;
private List<Item> items;
public bool doUpdate = true;
private void Awake()
{
Init();
}
private void Init()
{
if (items == null)
{
items = new List<Item>();
}
items.Clear();
iaxis = (int)axis;
for (int i = 0; i < bones.Count; i++)
{
if (!((Object)(object)bones[i] == (Object)null))
{
items.Add(new Item(bones[i], iaxis, length));
}
}
items.Sort((Item x, Item y) => x.deep.CompareTo(y.deep));
}
private void LateUpdate()
{
for (int i = 0; i < items.Count; i++)
{
items[i].Tick(rigid, 1f - damping, length, impact);
}
}
private void OnDrawGizmosSelected()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
if (bones == null)
{
return;
}
iaxis = (int)axis;
for (int i = 0; i < bones.Count; i++)
{
if (!((Object)(object)bones[i] == (Object)null))
{
Vector3 val = bones[i].position + ((iaxis == 0) ? bones[i].right : ((iaxis == 1) ? bones[i].up : bones[i].forward)) * length;
Gizmos.DrawLine(bones[i].position, val);
Gizmos.DrawWireSphere(val, Mathf.Abs(length) / 10f);
}
}
}
}
}