using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using FieldInjector;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using WeatherElectric.SecondaryMotion;
using WeatherElectric.SecondaryMotion.Drawbridge;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("A secondary motion system for BONELAB.")]
[assembly: AssemblyDescription("A secondary motion system for BONELAB.")]
[assembly: AssemblyCompany("Weather Electric")]
[assembly: AssemblyProduct("SecondaryMotion")]
[assembly: AssemblyCopyright("Developed by Mabel Amber")]
[assembly: AssemblyTrademark("Weather Electric")]
[assembly: AssemblyFileVersion("2.3.0")]
[assembly: MelonInfo(typeof(Main), "SecondaryMotion", "2.3.0", "Mabel Amber", "https://thunderstore.io/c/bonelab/p/WeatherElectric/SecondaryMotion/")]
[assembly: MelonColor(255, 135, 89, 255)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonOptionalDependencies(new string[] { "BoneLib", "DynamicBonesBL" })]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("2.3.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 WeatherElectric.SecondaryMotion
{
public class Main : MelonMod
{
internal const string Name = "SecondaryMotion";
internal const string Description = "A secondary motion system for BONELAB.";
internal const string Author = "Mabel Amber";
internal const string Company = "Weather Electric";
internal const string Version = "2.3.0";
internal const string DownloadLink = "https://thunderstore.io/c/bonelab/p/WeatherElectric/SecondaryMotion/";
internal static Instance Logger;
public override void OnInitializeMelon()
{
Logger = ((MelonBase)this).LoggerInstance;
Preferences.Init();
SerialisationHandler.Inject<SecondaryMotionCollider>(0);
SerialisationHandler.Inject<SecondaryMotion>(0);
}
public override void OnUpdate()
{
FrustrumPlaneHelper.UpdateFrustrum();
}
}
internal static class Preferences
{
private static readonly MelonPreferences_Category Category = MelonPreferences.CreateCategory("SecondaryMotion");
public static MelonPreferences_Entry<float> MinSimFPS { get; private set; }
public static MelonPreferences_Entry<bool> VisibilityCulling { get; private set; }
public static MelonPreferences_Entry<bool> OnlySimulateLocalPlayer { get; private set; }
public static void Init()
{
MinSimFPS = Category.CreateEntry<float>("MinSimFPS", 20f, "Minimum Effective FPS", "The minimum framerate for the simulation. Lower values are more resistant to jitter, but less responsive. Set to 0 to disable.", false, false, (ValueValidator)null, (string)null);
VisibilityCulling = Category.CreateEntry<bool>("VisibilityCulling", false, "Enable Visibility Culling (EXPERIMENTAL)", "Stops the simulation based on the visibility of the main meshes. Experimenal feature, it could easily break!", false, false, (ValueValidator)null, (string)null);
OnlySimulateLocalPlayer = Category.CreateEntry<bool>("OnlySimulateLocalPlayer", false, "[BONELAB-SPECIFIC] Only Simulate Local Player", "Only simulates bones on the local player rig, ignoring Fusion players. Will not work without BoneLib installed, doesn't actually require Fusion installed but does nothing of value without Fusion.", false, false, (ValueValidator)null, (string)null);
Category.SetFilePath(Path.Combine(MelonEnvironment.UserDataDirectory, "WeatherElectric.cfg"));
Category.SaveToFile(false);
}
}
public enum ColliderBounds
{
Outside,
Inside
}
public enum ColliderDirection
{
X,
Y,
Z
}
public enum ColliderType
{
Sphere,
Capsule
}
internal static class FrustrumPlaneHelper
{
private static Camera _mainCamera;
public static readonly Plane[] FrustumPlanes = (Plane[])(object)new Plane[6];
public static void UpdateCamera(Camera camera)
{
_mainCamera = camera;
}
public static void UpdateFrustrum()
{
if (Object.op_Implicit((Object)(object)_mainCamera))
{
GeometryUtility.CalculateFrustumPlanes(_mainCamera, Il2CppStructArray<Plane>.op_Implicit(FrustumPlanes));
}
}
}
public class SecondaryMotion : MonoBehaviour
{
public Transform root;
public List<Transform> exclusions;
public float endLength;
public Vector3 endOffset = Vector3.zero;
public UpdateMode updateMode;
public bool syncUpdateRateToGameTime = true;
public float updateRate = 60f;
public float blendWeight = 1f;
public bool enableCulling;
public SkinnedMeshRenderer[] visibleRenderers;
public float dampening = 0.1f;
public AnimationCurve dampeningCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float elasticity = 0.1f;
public AnimationCurve elasticityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float stiffness = 0.1f;
public AnimationCurve stiffnessCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float inertia;
public AnimationCurve inertiaCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float friction;
public AnimationCurve frictionCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float maxAngle = 180f;
public AnimationCurve maxAngleCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public bool enableGravity;
public Vector3 gravity = new Vector3(0f, -9.81f, 0f);
public Vector3 force = Vector3.zero;
public float collisionRadius;
public AnimationCurve collisionRadiusCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public List<SecondaryMotionCollider> colliders;
private Vector3 _objectMove;
private Vector3 _objectPrevPos;
private float _objectScale;
private float _weight = 1f;
private readonly List<SecondaryMotionParticleTree> _particleTrees = new List<SecondaryMotionParticleTree>();
private List<SecondaryMotionCollider> _effectiveCols;
private float _deltaTime;
private float _time;
private int _preUpdCnt;
private static int _updCnt;
private static int _prepFrame;
private bool _wasCulled;
private bool _shouldSimulate;
private bool? _isLocalPlayer;
private void Awake()
{
if (!Object.op_Implicit((Object)(object)root))
{
root = ((Component)this).transform;
}
}
private void Start()
{
ParticleSetup();
SyncUpdateRate();
FrustrumPlaneHelper.UpdateCamera(Camera.main);
if (DrawbridgeHelper.DynamicBonesAvailable)
{
DynamicBoneCompat.StripFrom(((Component)this).gameObject);
}
}
private void SyncUpdateRate()
{
if (syncUpdateRateToGameTime || updateMode == UpdateMode.FixedUpdate)
{
updateRate = 1f / Time.fixedDeltaTime;
}
}
private void FixedUpdate()
{
if (_shouldSimulate && updateMode == UpdateMode.FixedUpdate)
{
SimUpdate();
}
}
private void Update()
{
_shouldSimulate = CheckCulling();
if (_shouldSimulate)
{
if (updateMode != UpdateMode.FixedUpdate)
{
SimUpdate();
}
_updCnt++;
}
}
private void LateUpdate()
{
if (_shouldSimulate && _preUpdCnt != 0)
{
if (_updCnt > 0)
{
_updCnt = 0;
_prepFrame++;
}
SetWeight(blendWeight);
if (UpdateNeeded())
{
Prepare();
UpdateParticles();
ApplyParticles();
}
_preUpdCnt = 0;
}
}
private bool IsLocalPlayerCached()
{
if (!DrawbridgeHelper.BoneLibAvailable)
{
return true;
}
if (_isLocalPlayer.HasValue)
{
return _isLocalPlayer.Value;
}
if (BoneLibCompat.TryIsLocalPlayer(this, out var result))
{
_isLocalPlayer = result;
}
return result;
}
private bool CheckCulling()
{
if (DrawbridgeHelper.BoneLibAvailable && Preferences.OnlySimulateLocalPlayer.Value && !IsLocalPlayerCached())
{
if (!_wasCulled)
{
InitTransforms();
}
_wasCulled = true;
return false;
}
if (!enableCulling || !Preferences.VisibilityCulling.Value || visibleRenderers.Length == 0)
{
_wasCulled = false;
return true;
}
bool flag = !ShouldSimulate();
if (flag && !_wasCulled)
{
InitTransforms();
}
_wasCulled = flag;
return !flag;
bool ShouldSimulate()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
SkinnedMeshRenderer[] array = visibleRenderers;
foreach (SkinnedMeshRenderer val in array)
{
if (Object.op_Implicit((Object)(object)val) && GeometryUtility.TestPlanesAABB(Il2CppStructArray<Plane>.op_Implicit(FrustrumPlaneHelper.FrustumPlanes), ((Renderer)val).bounds))
{
return true;
}
}
return false;
}
}
private void Prepare()
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_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_0101: 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_0114: 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)
_deltaTime = updateMode switch
{
UpdateMode.UnscaledTime => Time.unscaledDeltaTime,
UpdateMode.FixedUpdate => Time.fixedDeltaTime * (float)_preUpdCnt,
_ => Time.deltaTime,
};
if (Preferences.MinSimFPS.Value > 0f)
{
float num = 1f / Preferences.MinSimFPS.Value;
_deltaTime = Mathf.Min(_deltaTime, num);
}
_objectScale = Mathf.Abs(((Component)this).transform.lossyScale.x);
_objectMove = ((Component)this).transform.position - _objectPrevPos;
_objectPrevPos = ((Component)this).transform.position;
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
if (particle.TransformIsntNull)
{
particle.TransformPos = particle.Transform.position;
particle.TransformLocalPos = particle.Transform.localPosition;
particle.TransformLocalToWorld = particle.Transform.localToWorldMatrix;
}
}
}
_effectiveCols?.Clear();
if (colliders == null)
{
return;
}
foreach (SecondaryMotionCollider collider in colliders)
{
if (Object.op_Implicit((Object)(object)collider) && ((Behaviour)collider).enabled)
{
if (_effectiveCols == null)
{
_effectiveCols = new List<SecondaryMotionCollider>();
}
_effectiveCols.Add(collider);
if (collider.PrepareFrame != _prepFrame)
{
collider.Prepare();
collider.PrepareFrame = _prepFrame;
}
}
}
}
private bool UpdateNeeded()
{
return _weight > 0f;
}
private void SimUpdate()
{
if (UpdateNeeded())
{
InitTransforms();
}
_preUpdCnt++;
}
private void OnEnable()
{
ResetParticlesPosition();
SyncUpdateRate();
}
private void OnDisable()
{
InitTransforms();
}
private void OnDidApplyAnimationProperties()
{
UpdateParams();
}
public void SetWeight(float w)
{
if (!Mathf.Approximately(_weight, w))
{
if (w == 0f)
{
InitTransforms();
}
else if (_weight == 0f)
{
ResetParticlesPosition();
}
_weight = (blendWeight = w);
}
}
private void ParticleSetup()
{
//IL_002c: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
_particleTrees.Clear();
if ((Object)(object)root != (Object)null)
{
BuildParticleTree(root);
}
_objectScale = Mathf.Abs(((Component)this).transform.lossyScale.x);
_objectPrevPos = ((Component)this).transform.position;
_objectMove = Vector3.zero;
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
CreateParticles(particleTree, particleTree.Root, -1, 0f);
}
UpdateParams();
}
private void BuildParticleTree(Transform rootTransform)
{
if (!((Object)(object)rootTransform == (Object)null))
{
SecondaryMotionParticleTree item = new SecondaryMotionParticleTree
{
Root = rootTransform
};
_particleTrees.Add(item);
}
}
[HideFromIl2Cpp]
private void CreateParticles(SecondaryMotionParticleTree particleTree, Transform bone, int parentIndex, float boneLength)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_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_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_00d3: 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_0090: 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_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_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_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: 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_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
while (true)
{
SecondaryMotionParticle secondaryMotionParticle = new SecondaryMotionParticle
{
Transform = bone,
TransformIsntNull = ((Object)(object)bone != (Object)null),
ParentIndex = parentIndex
};
Vector3 val;
if ((Object)(object)bone != (Object)null)
{
val = (secondaryMotionParticle.Position = (secondaryMotionParticle.PrevPos = bone.position));
secondaryMotionParticle.InitLocalPos = bone.localPosition;
secondaryMotionParticle.InitLocalRot = bone.localRotation;
}
else
{
Transform transform = particleTree.Particles[parentIndex].Transform;
if (endLength > 0f)
{
Transform parent = transform.parent;
if ((Object)(object)parent != (Object)null)
{
secondaryMotionParticle.EndOffset = transform.InverseTransformPoint(transform.position * 2f - parent.position) * endLength;
}
else
{
secondaryMotionParticle.EndOffset = new Vector3(endLength, 0f, 0f);
}
}
else
{
secondaryMotionParticle.EndOffset = transform.InverseTransformPoint(((Component)this).transform.TransformDirection(endOffset) + transform.position);
}
val = (secondaryMotionParticle.Position = (secondaryMotionParticle.PrevPos = transform.TransformPoint(secondaryMotionParticle.EndOffset)));
secondaryMotionParticle.InitLocalPos = Vector3.zero;
secondaryMotionParticle.InitLocalRot = Quaternion.identity;
}
if (parentIndex >= 0)
{
float num = boneLength;
val = particleTree.Particles[parentIndex].Transform.position - secondaryMotionParticle.Position;
boneLength = num + ((Vector3)(ref val)).magnitude;
secondaryMotionParticle.BoneLength = boneLength;
particleTree.BoneTotalLength = Mathf.Max(particleTree.BoneTotalLength, boneLength);
particleTree.Particles[parentIndex].ChildCount++;
}
int count = particleTree.Particles.Count;
particleTree.Particles.Add(secondaryMotionParticle);
if ((Object)(object)bone == (Object)null)
{
break;
}
for (int i = 0; i < bone.childCount; i++)
{
Transform child = bone.GetChild(i);
bool flag = false;
if (exclusions != null)
{
flag = exclusions.Contains(child);
}
if (!flag)
{
CreateParticles(particleTree, child, count, boneLength);
}
else if (endLength > 0f || endOffset != Vector3.zero)
{
CreateParticles(particleTree, null, count, boneLength);
}
}
if (bone.childCount == 0 && (endLength > 0f || endOffset != Vector3.zero))
{
bone = null;
parentIndex = count;
continue;
}
break;
}
}
private void UpdateParams()
{
SetWeight(blendWeight);
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
particle.Dampening = dampening;
particle.Elasticity = elasticity;
particle.Stiffness = stiffness;
particle.Inertia = inertia;
particle.Friction = friction;
particle.MaxAngle = maxAngle;
particle.CollisionRadius = collisionRadius;
if (particleTree.BoneTotalLength > 0f)
{
float num = particle.BoneLength / particleTree.BoneTotalLength;
if (dampeningCurve != null && ((Il2CppArrayBase<Keyframe>)(object)dampeningCurve.keys).Length > 0)
{
particle.Dampening *= dampeningCurve.Evaluate(num);
}
if (elasticityCurve != null && ((Il2CppArrayBase<Keyframe>)(object)elasticityCurve.keys).Length > 0)
{
particle.Elasticity *= elasticityCurve.Evaluate(num);
}
if (stiffnessCurve != null && ((Il2CppArrayBase<Keyframe>)(object)stiffnessCurve.keys).Length > 0)
{
particle.Stiffness *= stiffnessCurve.Evaluate(num);
}
if (inertiaCurve != null && ((Il2CppArrayBase<Keyframe>)(object)inertiaCurve.keys).Length > 0)
{
particle.Inertia *= inertiaCurve.Evaluate(num);
}
if (frictionCurve != null && ((Il2CppArrayBase<Keyframe>)(object)frictionCurve.keys).Length > 0)
{
particle.Friction *= frictionCurve.Evaluate(num);
}
if (collisionRadiusCurve != null && ((Il2CppArrayBase<Keyframe>)(object)collisionRadiusCurve.keys).Length > 0)
{
particle.CollisionRadius *= collisionRadiusCurve.Evaluate(num);
}
if (maxAngleCurve != null && ((Il2CppArrayBase<Keyframe>)(object)maxAngleCurve.keys).Length > 0)
{
particle.MaxAngle *= maxAngleCurve.Evaluate(num);
}
}
particle.Dampening = Mathf.Clamp01(particle.Dampening);
particle.Elasticity = Mathf.Clamp01(particle.Elasticity);
particle.Stiffness = Mathf.Clamp01(particle.Stiffness);
particle.Inertia = Mathf.Clamp01(particle.Inertia);
particle.Friction = Mathf.Clamp01(particle.Friction);
particle.MaxAngle = Mathf.Clamp(particle.MaxAngle, 0f, 180f);
particle.CollisionRadius = Mathf.Max(particle.CollisionRadius, 0f);
}
}
}
private void InitTransforms()
{
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
SecondaryMotionHelpers.SetTransforms(particleTree);
}
}
private void UpdateParticles()
{
if (_particleTrees.Count <= 0)
{
return;
}
int num = 1;
float timeVar = 1f;
float deltaTime = _deltaTime;
float stepTime = deltaTime;
if (updateMode == UpdateMode.Normal)
{
if (updateRate > 0f)
{
timeVar = deltaTime * updateRate;
}
}
else if (updateRate > 0f)
{
float num2 = 1f / updateRate;
stepTime = num2;
_time += deltaTime;
num = 0;
while (_time >= num2)
{
_time -= num2;
if (++num >= 3)
{
_time = 0f;
break;
}
}
}
if (num > 0)
{
for (int i = 0; i < num; i++)
{
UpdateParticlesLoop(stepTime, i);
UpdateParticlesLoop(timeVar);
}
}
else
{
SkipParticleUpdate();
}
}
private void UpdateParticlesLoop(float stepTime, int loopIndex)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_0057: 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_005b: 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_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: 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_0091: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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_00b1: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: 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_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
Vector3 val = (enableGravity ? ((gravity + force) * (_objectScale * stepTime * stepTime)) : (force * (_objectScale * stepTime * stepTime)));
Vector3 val2 = ((loopIndex == 0) ? _objectMove : Vector3.zero);
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
if (particle.ParentIndex >= 0)
{
Vector3 val3 = particle.Position - particle.PrevPos;
Vector3 val4 = val2 * particle.Inertia;
particle.PrevPos = particle.Position + val4;
float num = particle.Dampening;
if (particle.IsCollider)
{
num += particle.Friction;
if (num > 1f)
{
num = 1f;
}
particle.IsCollider = false;
}
particle.Position += val3 * (1f - num) + val + val4;
}
else
{
particle.PrevPos = particle.Position;
particle.Position = particle.TransformPos;
}
}
}
}
private void UpdateParticlesLoop(float timeVar)
{
//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_0077: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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_0101: 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_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: 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_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: 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_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: 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_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: 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_01a8: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
for (int i = 1; i < particleTree.Particles.Count; i++)
{
SecondaryMotionParticle secondaryMotionParticle = particleTree.Particles[i];
SecondaryMotionParticle secondaryMotionParticle2 = particleTree.Particles[secondaryMotionParticle.ParentIndex];
Vector3 val;
float magnitude;
if (!secondaryMotionParticle.TransformIsntNull)
{
val = ((Matrix4x4)(ref secondaryMotionParticle2.TransformLocalToWorld)).MultiplyVector(secondaryMotionParticle.EndOffset);
magnitude = ((Vector3)(ref val)).magnitude;
}
else
{
val = secondaryMotionParticle2.TransformPos - secondaryMotionParticle.TransformPos;
magnitude = ((Vector3)(ref val)).magnitude;
}
float num = magnitude;
float num2 = Mathf.Lerp(1f, secondaryMotionParticle.Stiffness, _weight);
if (num2 > 0f || secondaryMotionParticle.Elasticity > 0f)
{
Matrix4x4 transformLocalToWorld = secondaryMotionParticle2.TransformLocalToWorld;
((Matrix4x4)(ref transformLocalToWorld)).SetColumn(3, Vector4.op_Implicit(secondaryMotionParticle2.Position));
Vector3 val2 = ((Matrix4x4)(ref transformLocalToWorld)).MultiplyPoint3x4(secondaryMotionParticle.TransformIsntNull ? secondaryMotionParticle.TransformLocalPos : secondaryMotionParticle.EndOffset);
val = val2 - secondaryMotionParticle2.Position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
val = secondaryMotionParticle.Position - secondaryMotionParticle2.Position;
Vector3 normalized2 = ((Vector3)(ref val)).normalized;
if (Vector3.Angle(normalized, normalized2) > secondaryMotionParticle.MaxAngle)
{
Vector3 val3 = Vector3.RotateTowards(normalized, normalized2, secondaryMotionParticle.MaxAngle * ((float)Math.PI / 180f), 0f);
secondaryMotionParticle.Position = secondaryMotionParticle2.Position + val3 * num;
}
Vector3 val4 = val2 - secondaryMotionParticle.Position;
secondaryMotionParticle.Position += val4 * (secondaryMotionParticle.Elasticity * timeVar);
if (num2 > 0f)
{
val4 = val2 - secondaryMotionParticle.Position;
float magnitude2 = ((Vector3)(ref val4)).magnitude;
float num3 = num * (1f + (1f - num2) * 2f);
if (magnitude2 > num3)
{
secondaryMotionParticle.Position += val4 * ((magnitude2 - num3) / magnitude2);
}
}
}
if (_effectiveCols != null)
{
float particleRadius = secondaryMotionParticle.CollisionRadius * _objectScale;
foreach (SecondaryMotionCollider effectiveCol in _effectiveCols)
{
secondaryMotionParticle.IsCollider |= effectiveCol.Collide(ref secondaryMotionParticle.Position, particleRadius);
}
}
Vector3 val5 = secondaryMotionParticle2.Position - secondaryMotionParticle.Position;
float magnitude3 = ((Vector3)(ref val5)).magnitude;
if (magnitude3 > 0f)
{
secondaryMotionParticle.Position += val5 * ((magnitude3 - num) / magnitude3);
}
}
}
}
private void SkipParticleUpdate()
{
//IL_005a: 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_006a: 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_0081: 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_0042: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
List<SecondaryMotionParticle> particles = particleTree.Particles;
foreach (SecondaryMotionParticle item in particles)
{
if (item.ParentIndex < 0)
{
item.PrevPos = item.Position;
item.Position = item.TransformPos;
continue;
}
item.PrevPos += _objectMove;
item.Position += _objectMove;
SecondaryMotionParticle secondaryMotionParticle = particles[item.ParentIndex];
float num;
if (!item.TransformIsntNull)
{
Vector3 val = ((Matrix4x4)(ref secondaryMotionParticle.TransformLocalToWorld)).MultiplyVector(item.EndOffset);
num = ((Vector3)(ref val)).magnitude;
}
else
{
num = Vector3.Distance(secondaryMotionParticle.TransformPos, item.TransformPos);
}
float num2 = num;
if (Mathf.Lerp(1f, item.Stiffness, _weight) > 0f)
{
Matrix4x4 transformLocalToWorld = secondaryMotionParticle.TransformLocalToWorld;
((Matrix4x4)(ref transformLocalToWorld)).SetColumn(3, Vector4.op_Implicit(secondaryMotionParticle.Position));
Vector3 val2 = ((Matrix4x4)(ref transformLocalToWorld)).MultiplyPoint3x4(item.TransformIsntNull ? item.TransformLocalPos : item.EndOffset) - item.Position;
float magnitude = ((Vector3)(ref val2)).magnitude;
float num3 = num2 * (1f + (1f - stiffness) * 2f);
if (magnitude > num3)
{
item.Position += val2 / magnitude * (magnitude - num3);
}
}
Vector3 val3 = secondaryMotionParticle.Position - item.Position;
float magnitude2 = ((Vector3)(ref val3)).magnitude;
if (magnitude2 > 0f)
{
item.Position += val3 / magnitude2 * (magnitude2 - num2);
}
}
}
}
private void ResetParticlesPosition()
{
//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)
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
SecondaryMotionHelpers.ResetParticlePos(particleTree);
}
_objectPrevPos = ((Component)this).transform.position;
}
private void ApplyParticles()
{
//IL_00c0: 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_0053: 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_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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
for (int i = 1; i < particleTree.Particles.Count; i++)
{
SecondaryMotionParticle secondaryMotionParticle = particleTree.Particles[i];
SecondaryMotionParticle secondaryMotionParticle2 = particleTree.Particles[secondaryMotionParticle.ParentIndex];
if (secondaryMotionParticle2.ChildCount <= 1)
{
Vector3 val = (secondaryMotionParticle.TransformIsntNull ? secondaryMotionParticle.Transform.localPosition : secondaryMotionParticle.EndOffset);
Vector3 val2 = secondaryMotionParticle2.Transform.TransformDirection(val);
Vector3 val3 = secondaryMotionParticle.Position - secondaryMotionParticle2.Position;
Quaternion val4 = Quaternion.FromToRotation(val2, val3);
secondaryMotionParticle2.Transform.rotation = val4 * secondaryMotionParticle2.Transform.rotation;
}
if (secondaryMotionParticle.TransformIsntNull)
{
secondaryMotionParticle.Transform.position = secondaryMotionParticle.Position;
}
}
}
}
public SecondaryMotion(IntPtr ptr)
: base(ptr)
{
}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
//IL_00d6: 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_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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Expected O, but got Unknown
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Expected O, but got Unknown
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Expected O, but got Unknown
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Expected O, but got Unknown
}
public class SecondaryMotionCollider : MonoBehaviour
{
public ColliderType type;
public ColliderDirection direction = ColliderDirection.Y;
public ColliderBounds bounds;
public Vector3 center = Vector3.zero;
public float radius = 0.5f;
public float height;
public float radius2;
private float _scaledRadius;
private float _scaledRadius2;
private Vector3 _col1;
private Vector3 _col2;
private float _col1Col2Distance;
private int _collideType;
public int PrepareFrame { get; set; }
public void Start()
{
if (DrawbridgeHelper.DynamicBonesAvailable)
{
DynamicBoneCompat.StripFrom(((Component)this).gameObject, collider: true);
}
}
public void Prepare()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Abs(((Component)this).transform.lossyScale.x);
float num2 = height * 0.5f;
Vector3 val3;
if (radius2 <= 0f || Mathf.Abs(radius - radius2) < 0.01f)
{
_scaledRadius = radius * num;
float num3 = num2 - radius;
if (num3 <= 0f)
{
_col1 = ((Component)this).transform.TransformPoint(center);
_collideType = ((bounds != ColliderBounds.Outside) ? 1 : 0);
return;
}
Vector3 val = center;
Vector3 val2 = center;
switch (direction)
{
case ColliderDirection.X:
val.x += num3;
val2.x -= num3;
break;
case ColliderDirection.Y:
val.y += num3;
val2.y -= num3;
break;
case ColliderDirection.Z:
val.z += num3;
val2.z -= num3;
break;
default:
throw new ArgumentOutOfRangeException();
}
_col1 = ((Component)this).transform.TransformPoint(val);
_col2 = ((Component)this).transform.TransformPoint(val2);
val3 = _col2 - _col1;
_col1Col2Distance = ((Vector3)(ref val3)).magnitude;
_collideType = ((bounds == ColliderBounds.Outside) ? 2 : 3);
return;
}
float num4 = Mathf.Max(radius, radius2);
if (num2 - num4 <= 0f)
{
_scaledRadius = num4 * num;
_col1 = ((Component)this).transform.TransformPoint(center);
_collideType = ((bounds != ColliderBounds.Outside) ? 1 : 0);
return;
}
_scaledRadius = radius * num;
_scaledRadius2 = radius2 * num;
float num5 = num2 - radius;
float num6 = num2 - radius2;
Vector3 val4 = center;
Vector3 val5 = center;
switch (direction)
{
case ColliderDirection.X:
val4.x += num5;
val5.x -= num6;
break;
case ColliderDirection.Y:
val4.y += num5;
val5.y -= num6;
break;
case ColliderDirection.Z:
val4.z += num5;
val5.z -= num6;
break;
default:
throw new ArgumentOutOfRangeException();
}
_col1 = ((Component)this).transform.TransformPoint(val4);
_col2 = ((Component)this).transform.TransformPoint(val5);
val3 = _col2 - _col1;
_col1Col2Distance = ((Vector3)(ref val3)).magnitude;
_collideType = ((bounds == ColliderBounds.Outside) ? 4 : 5);
}
public bool Collide(ref Vector3 particlePosition, float particleRadius)
{
//IL_002d: 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_005f: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_00cb: 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)
return _collideType switch
{
0 => SecondaryMotionHelpers.CollideOutsideSphere(ref particlePosition, particleRadius, _col1, _scaledRadius),
1 => SecondaryMotionHelpers.CollideInsideSphere(ref particlePosition, particleRadius, _col1, _scaledRadius),
2 => SecondaryMotionHelpers.CollideOutsideCapsule(ref particlePosition, particleRadius, _col1, _col2, _scaledRadius, _col1Col2Distance),
3 => SecondaryMotionHelpers.CollideInsideCapsule(ref particlePosition, particleRadius, _col1, _col2, _scaledRadius, _col1Col2Distance),
4 => SecondaryMotionHelpers.CollideOutsideCapsule2(ref particlePosition, particleRadius, _col1, _col2, _scaledRadius, _scaledRadius2, _col1Col2Distance),
5 => SecondaryMotionHelpers.CollideInsideCapsule2(ref particlePosition, particleRadius, _col1, _col2, _scaledRadius, _scaledRadius2, _col1Col2Distance),
_ => false,
};
}
public SecondaryMotionCollider(IntPtr ptr)
: base(ptr)
{
}//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
}
internal static class SecondaryMotionHelpers
{
private static Assembly _dynamicBones;
public static bool CollideOutsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
float num = sphereRadius + particleRadius;
float num2 = num * num;
Vector3 val = particlePosition - sphereCenter;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
if (!(sqrMagnitude > 0f) || !(sqrMagnitude < num2))
{
return false;
}
float num3 = Mathf.Sqrt(sqrMagnitude);
particlePosition = sphereCenter + val * (num / num3);
return true;
}
public static bool CollideInsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
float num = sphereRadius - particleRadius;
float num2 = num * num;
Vector3 val = particlePosition - sphereCenter;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
if (!(sqrMagnitude > num2))
{
return false;
}
float num3 = Mathf.Sqrt(sqrMagnitude);
particlePosition = sphereCenter + val * (num / num3);
return true;
}
public static bool CollideOutsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius, float dirlen)
{
//IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_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_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//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_00b7: Unknown result type (might be due to invalid IL or missing references)
float num = capsuleRadius + particleRadius;
float num2 = num * num;
Vector3 val = capsuleP1 - capsuleP0;
Vector3 val2 = particlePosition - capsuleP0;
float num3 = Vector3.Dot(val2, val);
if (num3 <= 0f)
{
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude > 0f) || !(sqrMagnitude < num2))
{
return false;
}
float num4 = Mathf.Sqrt(sqrMagnitude);
particlePosition = capsuleP0 + val2 * (num / num4);
return true;
}
float num5 = dirlen * dirlen;
if (num3 >= num5)
{
val2 = particlePosition - capsuleP1;
float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude2 > 0f) || !(sqrMagnitude2 < num2))
{
return false;
}
float num6 = Mathf.Sqrt(sqrMagnitude2);
particlePosition = capsuleP1 + val2 * (num / num6);
return true;
}
Vector3 val3 = val2 - val * (num3 / num5);
float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude;
if (!(sqrMagnitude3 > 0f) || !(sqrMagnitude3 < num2))
{
return false;
}
float num7 = Mathf.Sqrt(sqrMagnitude3);
particlePosition += val3 * ((num - num7) / num7);
return true;
}
public static bool CollideInsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius, float dirlen)
{
//IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_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_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
float num = capsuleRadius - particleRadius;
float num2 = num * num;
Vector3 val = capsuleP1 - capsuleP0;
Vector3 val2 = particlePosition - capsuleP0;
float num3 = Vector3.Dot(val2, val);
if (num3 <= 0f)
{
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude > num2))
{
return false;
}
float num4 = Mathf.Sqrt(sqrMagnitude);
particlePosition = capsuleP0 + val2 * (num / num4);
return true;
}
float num5 = dirlen * dirlen;
if (num3 >= num5)
{
val2 = particlePosition - capsuleP1;
float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude2 > num2))
{
return false;
}
float num6 = Mathf.Sqrt(sqrMagnitude2);
particlePosition = capsuleP1 + val2 * (num / num6);
return true;
}
Vector3 val3 = val2 - val * (num3 / num5);
float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude;
if (!(sqrMagnitude3 > num2))
{
return false;
}
float num7 = Mathf.Sqrt(sqrMagnitude3);
particlePosition += val3 * ((num - num7) / num7);
return true;
}
public static bool CollideOutsideCapsule2(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius0, float capsuleRadius1, float dirlen)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//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_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_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_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0146: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = capsuleP1 - capsuleP0;
Vector3 val2 = particlePosition - capsuleP0;
float num = Vector3.Dot(val2, val);
if (num <= 0f)
{
float num2 = capsuleRadius0 + particleRadius;
float num3 = num2 * num2;
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude > 0f) || !(sqrMagnitude < num3))
{
return false;
}
float num4 = Mathf.Sqrt(sqrMagnitude);
particlePosition = capsuleP0 + val2 * (num2 / num4);
return true;
}
float num5 = dirlen * dirlen;
if (num >= num5)
{
float num6 = capsuleRadius1 + particleRadius;
float num7 = num6 * num6;
val2 = particlePosition - capsuleP1;
float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude2 > 0f) || !(sqrMagnitude2 < num7))
{
return false;
}
float num8 = Mathf.Sqrt(sqrMagnitude2);
particlePosition = capsuleP1 + val2 * (num6 / num8);
}
else
{
Vector3 val3 = val2 - val * (num / num5);
float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude;
float num9 = Vector3.Dot(val2, val / dirlen);
float num10 = Mathf.Lerp(capsuleRadius0, capsuleRadius1, num9 / dirlen) + particleRadius;
float num11 = num10 * num10;
if (!(sqrMagnitude3 > 0f) || !(sqrMagnitude3 < num11))
{
return false;
}
float num12 = Mathf.Sqrt(sqrMagnitude3);
particlePosition += val3 * ((num10 - num12) / num12);
}
return true;
}
public static bool CollideInsideCapsule2(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius0, float capsuleRadius1, float dirlen)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//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_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: 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_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = capsuleP1 - capsuleP0;
Vector3 val2 = particlePosition - capsuleP0;
float num = Vector3.Dot(val2, val);
if (num <= 0f)
{
float num2 = capsuleRadius0 - particleRadius;
float num3 = num2 * num2;
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude > num3))
{
return false;
}
float num4 = Mathf.Sqrt(sqrMagnitude);
particlePosition = capsuleP0 + val2 * (num2 / num4);
return true;
}
float num5 = dirlen * dirlen;
if (num >= num5)
{
float num6 = capsuleRadius1 - particleRadius;
float num7 = num6 * num6;
val2 = particlePosition - capsuleP1;
float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude2 > num7))
{
return false;
}
float num8 = Mathf.Sqrt(sqrMagnitude2);
particlePosition = capsuleP1 + val2 * (num6 / num8);
}
else
{
Vector3 val3 = val2 - val * (num / num5);
float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude;
float num9 = Vector3.Dot(val2, val / dirlen);
float num10 = Mathf.Lerp(capsuleRadius0, capsuleRadius1, num9 / dirlen) - particleRadius;
float num11 = num10 * num10;
if (!(sqrMagnitude3 > num11))
{
return false;
}
float num12 = Mathf.Sqrt(sqrMagnitude3);
particlePosition += val3 * ((num10 - num12) / num12);
}
return true;
}
public static void ResetParticlePos(SecondaryMotionParticleTree particleTree)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
if (particle.TransformIsntNull)
{
particle.Position = (particle.PrevPos = particle.Transform.position);
}
else
{
Transform transform = particleTree.Particles[particle.ParentIndex].Transform;
particle.Position = (particle.PrevPos = transform.TransformPoint(particle.EndOffset));
}
particle.IsCollider = false;
}
}
public static void SetTransforms(SecondaryMotionParticleTree particleTree)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
if (particle.TransformIsntNull)
{
particle.Transform.localPosition = particle.InitLocalPos;
particle.Transform.localRotation = particle.InitLocalRot;
}
}
}
public static Assembly GetDynamicBonesAssembly()
{
if (_dynamicBones != null)
{
return _dynamicBones;
}
_dynamicBones = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => string.Equals(a.GetName().Name, "DynamicBonesBL", StringComparison.OrdinalIgnoreCase));
if (!(_dynamicBones != null))
{
return _dynamicBones;
}
return null;
}
}
public class SecondaryMotionParticle
{
public Transform Transform;
public int ParentIndex;
public int ChildCount;
public float Dampening;
public float Elasticity;
public float Stiffness;
public float Inertia;
public float Friction;
public float MaxAngle;
public float CollisionRadius;
public float BoneLength;
public bool IsCollider;
public bool TransformIsntNull;
public Vector3 Position;
public Vector3 PrevPos;
public Vector3 EndOffset;
public Vector3 InitLocalPos;
public Quaternion InitLocalRot;
public Vector3 TransformPos;
public Vector3 TransformLocalPos;
public Matrix4x4 TransformLocalToWorld;
}
public class SecondaryMotionParticleTree
{
public Transform Root;
public float BoneTotalLength;
public readonly List<SecondaryMotionParticle> Particles = new List<SecondaryMotionParticle>();
}
public enum UpdateMode
{
Normal,
FixedUpdate,
UnscaledTime
}
}
namespace WeatherElectric.SecondaryMotion.Drawbridge
{
internal static class BoneLibCompat
{
[MethodImpl(MethodImplOptions.NoInlining)]
public static bool TryIsLocalPlayer(SecondaryMotion sm, out bool result)
{
RigManager rigManager = Player.RigManager;
result = false;
if (!Object.op_Implicit((Object)(object)rigManager))
{
return false;
}
result = ((Component)sm).transform.IsChildOf(((Component)rigManager).transform);
return true;
}
}
internal static class DrawbridgeHelper
{
private static bool? _dynamicBonesAvailable;
private static bool? _boneLibAvailable;
public static bool DynamicBonesAvailable
{
get
{
bool valueOrDefault = _dynamicBonesAvailable == true;
if (!_dynamicBonesAvailable.HasValue)
{
valueOrDefault = IsGame("BONELAB") && CheckIfAsmLoaded("DynamicBonesBL");
_dynamicBonesAvailable = valueOrDefault;
return valueOrDefault;
}
return valueOrDefault;
}
}
public static bool BoneLibAvailable
{
get
{
bool valueOrDefault = _boneLibAvailable == true;
if (!_boneLibAvailable.HasValue)
{
valueOrDefault = IsGame("BONELAB") && CheckIfAsmLoaded("BoneLib");
_boneLibAvailable = valueOrDefault;
return valueOrDefault;
}
return valueOrDefault;
}
}
private static bool CheckIfAsmLoaded(string name)
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
for (int i = 0; i < assemblies.Length; i++)
{
if (string.Equals(assemblies[i].GetName().Name, name, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
private static bool IsGame(string gameName)
{
return string.Equals(MelonUtils.CurrentGameAttribute.Name, gameName, StringComparison.CurrentCultureIgnoreCase);
}
}
internal static class DynamicBoneCompat
{
[MethodImpl(MethodImplOptions.NoInlining)]
public static void StripFrom(GameObject gameObject, bool collider = false)
{
if (collider)
{
foreach (DynamicBoneColliderBase component in gameObject.GetComponents<DynamicBoneColliderBase>())
{
Object.Destroy((Object)(object)component);
}
return;
}
foreach (DynamicBone component2 in gameObject.GetComponents<DynamicBone>())
{
Object.Destroy((Object)(object)component2);
}
}
}
}