using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using Atlas;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Technie.PhysicsCreator.QHull;
using UnityEditor;
using UnityEngine;
using UnityEngine.AI;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace MeatKit
{
public class HideInNormalInspectorAttribute : PropertyAttribute
{
}
}
namespace JalexInteractive.CroftManorSB
{
[BepInPlugin("JalexInteractive.CroftManorSB", "CroftManorSB", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("nrgill28.Atlas", "1.0.1")]
public class CroftManorSBPlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "JalexInteractive.CroftManorSB");
AtlasPlugin.RegisterScene(Path.Combine(BasePath, "croft manor - sandbox"));
}
}
}
[Serializable]
public class AnimatedTexture
{
public Texture textureWithFrames;
public int numberOfFramesHorizontal = 1;
public int numberOfFramesVertical = 1;
public bool needsFlip = true;
private float mOneFrameUstep;
private float mOneFrameVstep;
public void Init()
{
mOneFrameUstep = 1f / (float)numberOfFramesHorizontal;
mOneFrameVstep = 1f / (float)numberOfFramesVertical;
}
public Vector2[] getUVsForFrame(int aFrameNumber)
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
float num = 0f;
float num2 = 0f;
int num3 = aFrameNumber / numberOfFramesHorizontal;
if (needsFlip && aFrameNumber % numberOfFramesHorizontal == 0)
{
num3--;
}
int num4 = aFrameNumber - num3 * numberOfFramesHorizontal;
num = mOneFrameUstep * (float)num4;
num2 = mOneFrameVstep * (float)num3;
Vector2[] array = (Vector2[])(object)new Vector2[2];
if (needsFlip)
{
ref Vector2 reference = ref array[0];
reference = new Vector2(num, 1f - num2);
ref Vector2 reference2 = ref array[1];
reference2 = new Vector2(0f - mOneFrameUstep, 0f - mOneFrameVstep);
}
else
{
ref Vector2 reference3 = ref array[0];
reference3 = new Vector2(num, num2);
ref Vector2 reference4 = ref array[1];
reference4 = new Vector2(mOneFrameUstep, mOneFrameVstep);
}
return array;
}
}
[Serializable]
public class TextureAnimation
{
[SerializeField]
public AnimatedTexture animatedTex;
public int startAtFrame = 0;
public int endAtFrame = 0;
public float animationDuration = 1f;
public bool loop = true;
public bool pingpong = false;
public int goToAnimationOnEnd = -1;
private float mTimePlayed = 0f;
private bool mPlaying = false;
private int mDeltaFrames = 0;
private float mTimePerFrame = 0f;
private Vector2[] mUVDataThisFrame;
private float mTimeToUseForFrameCalc;
private bool mSendEndedNotification = false;
public void InitTexture()
{
animatedTex.Init();
mDeltaFrames = endAtFrame - startAtFrame;
mTimePerFrame = animationDuration / (float)(mDeltaFrames + 1);
mUVDataThisFrame = animatedTex.getUVsForFrame(startAtFrame);
}
public void Play()
{
mPlaying = true;
}
public void Pause()
{
mPlaying = false;
}
public void Stop()
{
Pause();
mTimePlayed = 0f;
}
public bool Update(float aDeltaTime, Material aMaterial, bool aXFlipped)
{
UpdateTime(aDeltaTime);
if (mPlaying)
{
if (mDeltaFrames != 0)
{
int num = ((mDeltaFrames <= 0) ? Mathf.CeilToInt(mTimeToUseForFrameCalc / mTimePerFrame) : Mathf.FloorToInt(mTimeToUseForFrameCalc / mTimePerFrame));
int aFrameNumber = startAtFrame + num;
if (mTimePlayed >= animationDuration && !pingpong)
{
mUVDataThisFrame = animatedTex.getUVsForFrame(endAtFrame);
}
else
{
mUVDataThisFrame = animatedTex.getUVsForFrame(aFrameNumber);
}
}
if (aXFlipped)
{
ref Vector2 reference = ref mUVDataThisFrame[0];
reference.x += mUVDataThisFrame[1].x;
mUVDataThisFrame[1].x = 0f - mUVDataThisFrame[1].x;
}
updateUVsForMaterial(aMaterial);
}
return mSendEndedNotification;
}
public void updateUVsForMaterial(Material aMaterial)
{
//IL_0013: 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)
aMaterial.SetTextureOffset("_MainTex", mUVDataThisFrame[0]);
aMaterial.SetTextureScale("_MainTex", mUVDataThisFrame[1]);
}
public bool UpdateTime(float aDeltaTime)
{
mSendEndedNotification = false;
if (mPlaying)
{
mTimePlayed += aDeltaTime;
mTimeToUseForFrameCalc = mTimePlayed;
if (mTimePlayed > animationDuration)
{
if (loop)
{
mTimePlayed -= animationDuration;
mTimeToUseForFrameCalc -= animationDuration;
}
else if (pingpong)
{
float num = animationDuration - mTimePerFrame * 2f;
float num2 = animationDuration + num;
if (mTimePlayed <= num2)
{
mTimeToUseForFrameCalc = mTimePerFrame + num - (mTimePlayed - animationDuration);
}
else
{
mTimePlayed -= num2;
mTimeToUseForFrameCalc -= num2;
}
}
else
{
mTimePlayed = animationDuration;
mTimeToUseForFrameCalc = animationDuration;
if (goToAnimationOnEnd >= 0)
{
mSendEndedNotification = true;
}
}
}
}
return mSendEndedNotification;
}
public Texture getTexture()
{
InitTexture();
return animatedTex.textureWithFrames;
}
}
public class AnimatedTextureObject : MonoBehaviour
{
[SerializeField]
public TextureAnimation[] animations;
public int currentActiveAnimation = 0;
public int targetElement = -1;
private bool mActiveAnimation = false;
private bool mXFlipped = false;
private void Start()
{
StartAnimation(currentActiveAnimation);
}
public bool StartAnimation(int aAnimationIndex)
{
if (animations.Length > aAnimationIndex)
{
currentActiveAnimation = aAnimationIndex;
Renderer component = ((Component)this).gameObject.GetComponent<Renderer>();
if (targetElement >= 0)
{
component.materials[targetElement].SetTexture("_MainTex", animations[aAnimationIndex].getTexture());
animations[aAnimationIndex].updateUVsForMaterial(component.materials[targetElement]);
}
else
{
component.material.SetTexture("_MainTex", animations[aAnimationIndex].getTexture());
animations[aAnimationIndex].updateUVsForMaterial(component.material);
}
animations[aAnimationIndex].Stop();
animations[aAnimationIndex].Play();
mActiveAnimation = true;
}
else
{
mActiveAnimation = false;
}
return mActiveAnimation;
}
private void Update()
{
if (mActiveAnimation)
{
bool flag = false;
if ((!((Component)this).GetComponent<Renderer>().isVisible) ? animations[currentActiveAnimation].UpdateTime(Time.deltaTime) : animations[currentActiveAnimation].Update(Time.deltaTime, ((Component)this).gameObject.GetComponent<Renderer>().materials[targetElement], mXFlipped))
{
StartAnimation(animations[currentActiveAnimation].goToAnimationOnEnd);
}
}
}
public void Play()
{
if (animations.Length > currentActiveAnimation)
{
animations[currentActiveAnimation].Play();
}
}
public void Pause()
{
if (animations.Length > currentActiveAnimation)
{
animations[currentActiveAnimation].Pause();
}
}
public void Stop()
{
if (animations.Length > currentActiveAnimation)
{
animations[currentActiveAnimation].Stop();
mActiveAnimation = false;
}
}
public void setReverseHorizontalDirection(bool to)
{
mXFlipped = to;
}
}
public class ClothOnWind : MonoBehaviour
{
private Cloth clothMod;
private Vector3 TargetWindForce;
public Vector3 MaxWindForce;
public float WindForceIntervals = 1f;
public Vector3 NegativeWindForce;
private void Start()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
clothMod = ((Component)this).GetComponent<Cloth>();
clothMod.externalAcceleration = NegativeWindForce;
TargetWindForce = MaxWindForce;
if (WindForceIntervals <= 0f)
{
WindForceIntervals = 0.1f;
}
}
private void Update()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_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_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)
clothMod.externalAcceleration = Vector3.MoveTowards(clothMod.externalAcceleration, TargetWindForce, WindForceIntervals * Time.deltaTime);
if (clothMod.externalAcceleration == MaxWindForce)
{
TargetWindForce = NegativeWindForce;
}
if (clothMod.externalAcceleration == NegativeWindForce)
{
TargetWindForce = MaxWindForce;
}
}
}
namespace Packer
{
[RequireComponent(typeof(AudioSource))]
public class Door : MonoBehaviour
{
[Tooltip("Switches connected to this door")]
public DoorSwitch[] switches;
[Tooltip("How fast the door opens (Meters a second)")]
public float doorMoveSpeed = 1f;
[Tooltip("How fast the door opens (Degrees a second")]
public float doorRotateSpeed = 1f;
[Tooltip("Auto close timing (>0 for no auto)")]
public float autoClose = 0f;
[Tooltip("Default State of this door")]
public bool open = false;
[Tooltip("Does this door move?")]
public bool mover = false;
[Tooltip("The closed local position of the door")]
public Vector3 closeOffset;
[Tooltip("The opened local position of the door")]
public Vector3 openOffset;
[Tooltip("Does this door rotate?")]
public bool rotator = false;
[Tooltip("The closed local rotation of the door, would reccomend not modifying these values directly unless you really know what you're doing")]
public Quaternion closeRotation;
[Tooltip("The opened local rotation of the door, would reccomend not modifying these values directly unless you really know what you're doing")]
public Quaternion openRotation;
public AudioClip openSound;
public AudioClip closeSound;
private AudioSource audioSource;
private bool moving = false;
private int doorIndex;
private List<IEnumerator> WaitList = new List<IEnumerator>();
private void Start()
{
audioSource = ((Component)this).GetComponent<AudioSource>();
((Component)this).transform.hasChanged = false;
}
private void Update()
{
//IL_0055: 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_012d: 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_00b6: 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_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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0166: 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_00de: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
while (WaitList.Count > 0)
{
((MonoBehaviour)this).StartCoroutine(WaitList[0]);
WaitList.RemoveAt(0);
}
if (mover)
{
if (open && ((Component)this).transform.localPosition != openOffset)
{
((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, openOffset, doorMoveSpeed * Time.deltaTime);
moving = true;
}
else if (!open && ((Component)this).transform.localPosition != closeOffset)
{
((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, closeOffset, doorMoveSpeed * Time.deltaTime);
moving = true;
}
else
{
moving = false;
}
}
if (rotator)
{
if (open && ((Component)this).transform.rotation != openRotation)
{
((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, openRotation, doorRotateSpeed * Time.deltaTime);
moving = true;
}
else if (!open && ((Component)this).transform.rotation != closeRotation)
{
((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, closeRotation, doorRotateSpeed * Time.deltaTime);
moving = true;
}
else
{
moving = false;
}
}
if (open && autoClose > 0f && !moving)
{
new Thread((ThreadStart)delegate
{
WaitList.Add(Wait());
}).Start();
}
}
public void SetDoor(bool state)
{
open = state;
if (open)
{
if ((Object)(object)openSound != (Object)null)
{
audioSource.PlayOneShot(openSound);
}
}
else if ((Object)(object)closeSound != (Object)null)
{
audioSource.PlayOneShot(closeSound);
}
}
public void SetOpenOffset()
{
//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)
if (!ErrorCheck())
{
openOffset = ((Component)this).transform.localPosition;
}
}
public void SetCloseOffset()
{
//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)
if (!ErrorCheck())
{
closeOffset = ((Component)this).transform.localPosition;
}
}
public void MoveToOpenOffset()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
((Component)this).transform.localPosition = openOffset;
}
}
public void MoveToCloseOffset()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
((Component)this).transform.localPosition = closeOffset;
}
}
public void SetOpenRotation()
{
//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)
if (!ErrorCheck())
{
openRotation = ((Component)this).transform.rotation;
}
}
public void SetCloseRotation()
{
//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)
if (!ErrorCheck())
{
closeRotation = ((Component)this).transform.rotation;
}
}
public void MoveToOpenRotation()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
((Component)this).transform.rotation = openRotation;
}
}
public void MoveToCloseRotation()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
((Component)this).transform.rotation = closeRotation;
}
}
private bool ErrorCheck()
{
if ((Object)(object)((Component)this).transform.parent == (Object)null)
{
Debug.LogError((object)(((Object)this).name + " is missing a parent gameobject"));
return true;
}
return false;
}
private IEnumerator Wait()
{
yield return (object)new WaitForSeconds(autoClose);
while (open && !moving)
{
if (!((Object)(object)switches[0] != (Object)null))
{
continue;
}
for (int i = 0; i < switches[0].doors.Length; i++)
{
if (((Object)switches[0].doors[i]).name == ((Object)this).name)
{
doorIndex = i;
}
}
switches[0].ToggleSingleDoor(doorIndex);
}
}
}
[RequireComponent(typeof(AudioSource), typeof(BoxCollider))]
public class DoorSwitch : MonoBehaviour
{
[Tooltip("All the doors that will be triggered when this switch is hit")]
public Door[] doors;
[Tooltip("All Switches that will be set to this switches state")]
public DoorSwitch[] switches;
[Tooltip("Default switch state")]
public bool switchState = false;
[Tooltip("Does this button accept only an empty hand, or any collision")]
public bool physicsActive = false;
public AudioClip openSound;
public AudioClip closeSound;
private BoxCollider triggerZone;
private LayerMask mask;
private AudioSource audioSource;
private float timeout = 0f;
private void Start()
{
audioSource = ((Component)this).GetComponent<AudioSource>();
triggerZone = ((Component)this).GetComponent<BoxCollider>();
((Collider)triggerZone).isTrigger = true;
((Component)this).gameObject.layer = LayerMask.NameToLayer("Enviroment");
}
private void Update()
{
if (timeout > 0f)
{
timeout = Mathf.Clamp(timeout -= Time.deltaTime, 0f, 1f);
}
}
public void ToggleDoors()
{
switchState = !switchState;
for (int i = 0; i < doors.Length; i++)
{
if ((Object)(object)doors[i] != (Object)null)
{
doors[i].SetDoor(!doors[i].open);
}
}
for (int j = 0; j < switches.Length; j++)
{
if ((Object)(object)switches[j] != (Object)null)
{
switches[j].switchState = switchState;
}
}
if (switchState)
{
if ((Object)(object)openSound != (Object)null)
{
audioSource.PlayOneShot(openSound);
}
}
else if ((Object)(object)closeSound != (Object)null)
{
audioSource.PlayOneShot(closeSound);
}
}
public void ToggleSingleDoor(int doorIndex)
{
doors[doorIndex].SetDoor(!doors[doorIndex].open);
}
private void OnTriggerEnter(Collider collider)
{
if (physicsActive)
{
if (!(timeout > 0f))
{
timeout = 1f;
ToggleDoors();
}
}
else if (((Component)collider).gameObject.tag == "GameController" && !(timeout > 0f))
{
timeout = 1f;
ToggleDoors();
}
}
}
}
public class PlayModeCameraController : MonoBehaviour
{
[SerializeField]
private float navigationSpeed = 2.4f;
[SerializeField]
private float shiftMultiplier = 2f;
[SerializeField]
private float sensitivity = 1f;
[SerializeField]
private float panSensitivity = 0.5f;
[SerializeField]
private float mouseWheelZoomSpeed = 1f;
private Camera cam;
private Vector3 anchorPoint;
private Quaternion anchorRot;
private bool isPanning;
private float pan_x;
private float pan_y;
private Vector3 panComplete;
private void Awake()
{
cam = ((Component)this).GetComponent<Camera>();
}
private void Update()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: 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_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_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_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: 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_006a: 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_0087: 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_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_0098: 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_00a6: 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_00b6: 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_00c4: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_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)
MousePanning();
if (isPanning)
{
return;
}
if (Input.GetMouseButton(1))
{
Vector3 val = Vector3.zero;
float num = navigationSpeed * ((!Input.GetKey((KeyCode)304)) ? 1f : shiftMultiplier) * Time.deltaTime * 9.1f;
if (Input.GetKey((KeyCode)119))
{
val += Vector3.forward * num;
}
if (Input.GetKey((KeyCode)115))
{
val -= Vector3.forward * num;
}
if (Input.GetKey((KeyCode)100))
{
val += Vector3.right * num;
}
if (Input.GetKey((KeyCode)97))
{
val -= Vector3.right * num;
}
if (Input.GetKey((KeyCode)101))
{
val += Vector3.up * num;
}
if (Input.GetKey((KeyCode)113))
{
val -= Vector3.up * num;
}
((Component)this).transform.Translate(val);
}
if (Input.GetMouseButtonDown(1))
{
anchorPoint = new Vector3(Input.mousePosition.y, 0f - Input.mousePosition.x);
anchorRot = ((Component)this).transform.rotation;
}
if (Input.GetMouseButton(1))
{
Quaternion rotation = anchorRot;
Vector3 val2 = anchorPoint - new Vector3(Input.mousePosition.y, 0f - Input.mousePosition.x);
((Quaternion)(ref rotation)).eulerAngles = ((Quaternion)(ref rotation)).eulerAngles + val2 * sensitivity;
((Component)this).transform.rotation = rotation;
}
MouseWheeling();
}
private void MouseWheeling()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_0068: 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_0079: 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_009c: 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)
//IL_00ac: 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)
float num = 10f * (mouseWheelZoomSpeed * ((!Input.GetKey((KeyCode)304)) ? 1f : shiftMultiplier) * Time.deltaTime * 9.1f);
Vector3 val = ((Component)this).transform.position;
if (Input.GetAxis("Mouse ScrollWheel") < 0f)
{
val -= ((Component)this).transform.forward * num;
((Component)this).transform.position = val;
}
if (Input.GetAxis("Mouse ScrollWheel") > 0f)
{
val += ((Component)this).transform.forward * num;
((Component)this).transform.position = val;
}
}
private void MousePanning()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
pan_x = (0f - Input.GetAxis("Mouse X")) * panSensitivity;
pan_y = (0f - Input.GetAxis("Mouse Y")) * panSensitivity;
panComplete = new Vector3(pan_x, pan_y, 0f);
if (Input.GetMouseButtonDown(2))
{
isPanning = true;
}
if (Input.GetMouseButtonUp(2))
{
isPanning = false;
}
if (isPanning)
{
((Component)this).transform.Translate(panComplete);
}
}
}
[ExecuteInEditMode]
public class ReCalcCubeTexture : MonoBehaviour
{
private Vector3 _currentScale;
private void Start()
{
Calculate();
}
private void Update()
{
Calculate();
}
public void Calculate()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
if (!(_currentScale == ((Component)this).transform.localScale) && !CheckForDefaultSize())
{
_currentScale = ((Component)this).transform.localScale;
Mesh mesh = GetMesh();
mesh.uv = SetupUvMap(mesh.uv);
((Object)mesh).name = "Cube Instance";
if ((int)((Component)this).GetComponent<Renderer>().sharedMaterial.mainTexture.wrapMode != 0)
{
((Component)this).GetComponent<Renderer>().sharedMaterial.mainTexture.wrapMode = (TextureWrapMode)0;
}
}
}
private Mesh GetMesh()
{
MeshFilter component = ((Component)this).GetComponent<MeshFilter>();
Mesh val = Object.Instantiate<Mesh>(component.sharedMesh);
return component.mesh = val;
}
private Vector2[] SetupUvMap(Vector2[] meshUVs)
{
//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_0045: 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_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_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_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_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_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_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_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_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: 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_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_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_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: 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_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
float x = _currentScale.x;
float z = _currentScale.z;
float y = _currentScale.y;
ref Vector2 reference = ref meshUVs[2];
reference = new Vector2(0f, y);
ref Vector2 reference2 = ref meshUVs[3];
reference2 = new Vector2(x, y);
ref Vector2 reference3 = ref meshUVs[0];
reference3 = new Vector2(0f, 0f);
ref Vector2 reference4 = ref meshUVs[1];
reference4 = new Vector2(x, 0f);
ref Vector2 reference5 = ref meshUVs[7];
reference5 = new Vector2(0f, 0f);
ref Vector2 reference6 = ref meshUVs[6];
reference6 = new Vector2(x, 0f);
ref Vector2 reference7 = ref meshUVs[11];
reference7 = new Vector2(0f, y);
ref Vector2 reference8 = ref meshUVs[10];
reference8 = new Vector2(x, y);
ref Vector2 reference9 = ref meshUVs[19];
reference9 = new Vector2(z, 0f);
ref Vector2 reference10 = ref meshUVs[17];
reference10 = new Vector2(0f, y);
ref Vector2 reference11 = ref meshUVs[16];
reference11 = new Vector2(0f, 0f);
ref Vector2 reference12 = ref meshUVs[18];
reference12 = new Vector2(z, y);
ref Vector2 reference13 = ref meshUVs[23];
reference13 = new Vector2(z, 0f);
ref Vector2 reference14 = ref meshUVs[21];
reference14 = new Vector2(0f, y);
ref Vector2 reference15 = ref meshUVs[20];
reference15 = new Vector2(0f, 0f);
ref Vector2 reference16 = ref meshUVs[22];
reference16 = new Vector2(z, y);
ref Vector2 reference17 = ref meshUVs[4];
reference17 = new Vector2(x, 0f);
ref Vector2 reference18 = ref meshUVs[5];
reference18 = new Vector2(0f, 0f);
ref Vector2 reference19 = ref meshUVs[8];
reference19 = new Vector2(x, z);
ref Vector2 reference20 = ref meshUVs[9];
reference20 = new Vector2(0f, z);
ref Vector2 reference21 = ref meshUVs[13];
reference21 = new Vector2(x, 0f);
ref Vector2 reference22 = ref meshUVs[14];
reference22 = new Vector2(0f, 0f);
ref Vector2 reference23 = ref meshUVs[12];
reference23 = new Vector2(x, z);
ref Vector2 reference24 = ref meshUVs[15];
reference24 = new Vector2(0f, z);
return meshUVs;
}
private bool CheckForDefaultSize()
{
//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)
if (_currentScale != Vector3.one)
{
return false;
}
GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
Object.DestroyImmediate((Object)(object)((Component)this).GetComponent<MeshFilter>());
((Component)this).gameObject.AddComponent<MeshFilter>();
((Component)this).GetComponent<MeshFilter>().sharedMesh = val.GetComponent<MeshFilter>().sharedMesh;
Object.DestroyImmediate((Object)(object)val);
return true;
}
}
public class ShiftUVs : MonoBehaviour
{
private void Start()
{
}
public void ShiftEm(GameObject OBJ, int targetElement)
{
//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_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_00ff: Unknown result type (might be due to invalid IL or missing references)
List<Vector2> list = new List<Vector2>();
MeshFilter val = Object.Instantiate<MeshFilter>(OBJ.GetComponent<MeshFilter>());
Renderer component = OBJ.GetComponent<Renderer>();
Mesh val2 = Object.Instantiate<Mesh>(val.sharedMesh);
val2.GetUVs(0, list);
Debug.Log((object)list);
Debug.Log((object)val);
Debug.Log((object)component);
Debug.Log((object)val2);
int i = 0;
for (int subMeshCount = val2.subMeshCount; i < subMeshCount; i++)
{
string name = ((Object)component.materials[targetElement]).name;
int num = 0;
int num2 = 4;
if (!(name == "TeBl_0_1 (Instance)"))
{
continue;
}
HashSet<int> hashSet = new HashSet<int>(val2.GetTriangles(i));
float num3 = (float)num / (float)num2;
float num4 = Mathf.Floor(num3) / (float)num2;
num3 -= Mathf.Floor(num3);
num4 -= Mathf.Floor(num4);
foreach (int item in hashSet)
{
list[item] = new Vector2(list[item].x + num3, list[item].y - num4);
}
}
val.sharedMesh = val2;
}
private void Update()
{
}
}
public class WinstonScript : MonoBehaviour
{
private NavMeshHit hit;
private NavMeshAgent AgentWinston;
private Vector3 Dest;
public AudioSource[] audioSources;
public AudioClip[] moans;
public AudioClip[] rattles;
public GameObject Target;
private bool moving;
private void Awake()
{
AgentWinston = ((Component)this).GetComponent<NavMeshAgent>();
}
private void Start()
{
((MonoBehaviour)this).StartCoroutine(MoanForMe());
((MonoBehaviour)this).StartCoroutine(RattleTheTray());
}
private void LateUpdate()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00d6: 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_0084: 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)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Target == (Object)null)
{
Dest = GM.CurrentPlayerBody.Head.position;
}
else
{
Dest = Target.transform.position;
}
if (((Behaviour)AgentWinston).isActiveAndEnabled)
{
if (!Mathf.Approximately(AgentWinston.velocity.z, 0f) && !Mathf.Approximately(AgentWinston.velocity.x, 0f))
{
Quaternion val = Quaternion.LookRotation(AgentWinston.velocity);
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val, Time.deltaTime);
}
AgentWinston.SetDestination(Dest);
}
}
private IEnumerator MoanForMe()
{
while (true)
{
int pickedMoanInt = Random.Range(0, 8);
AudioClip pickedMoan = moans[pickedMoanInt];
int waitTime = Random.Range(10, 15);
yield return (object)new WaitForSeconds((float)waitTime);
audioSources[0].PlayOneShot(pickedMoan);
}
}
private IEnumerator RattleTheTray()
{
while (true)
{
int pickedRattleInt = Random.Range(0, 2);
AudioClip pickedRattle = rattles[pickedRattleInt];
if (Vector3.Distance(((Component)this).transform.position, Dest) > 3.5f)
{
audioSources[1].PlayOneShot(pickedRattle);
}
int waitTime = Random.Range(6, 10);
yield return (object)new WaitForSeconds((float)waitTime);
}
}
}
namespace SimpleLightProbePlacer
{
[RequireComponent(typeof(LightProbeGroup))]
[AddComponentMenu("Rendering/Light Probe Group Control")]
public class LightProbeGroupControl : MonoBehaviour
{
[SerializeField]
private float m_mergeDistance = 0.5f;
[SerializeField]
private bool m_usePointLights = true;
[SerializeField]
private float m_pointLightRange = 1f;
private int m_mergedProbes;
private LightProbeGroup m_lightProbeGroup;
public float MergeDistance
{
get
{
return m_mergeDistance;
}
set
{
m_mergeDistance = value;
}
}
public int MergedProbes => m_mergedProbes;
public bool UsePointLights
{
get
{
return m_usePointLights;
}
set
{
m_usePointLights = value;
}
}
public float PointLightRange
{
get
{
return m_pointLightRange;
}
set
{
m_pointLightRange = value;
}
}
public LightProbeGroup LightProbeGroup
{
get
{
if ((Object)(object)m_lightProbeGroup != (Object)null)
{
return m_lightProbeGroup;
}
return m_lightProbeGroup = ((Component)this).GetComponent<LightProbeGroup>();
}
}
public void DeleteAll()
{
LightProbeGroup.probePositions = null;
m_mergedProbes = 0;
}
public void Create()
{
DeleteAll();
List<Vector3> list = CreatePositions();
list.AddRange(CreateAroundPointLights(m_pointLightRange));
list = MergeClosestPositions(list, m_mergeDistance, out m_mergedProbes);
ApplyPositions(list);
}
public void Merge()
{
if (LightProbeGroup.probePositions != null)
{
List<Vector3> source = MergeClosestPositions(LightProbeGroup.probePositions.ToList(), m_mergeDistance, out m_mergedProbes);
source = source.Select((Vector3 x) => ((Component)this).transform.TransformPoint(x)).ToList();
ApplyPositions(source);
}
}
private void ApplyPositions(List<Vector3> positions)
{
LightProbeGroup.probePositions = positions.Select((Vector3 x) => ((Component)this).transform.InverseTransformPoint(x)).ToArray();
}
private static List<Vector3> CreatePositions()
{
LightProbeVolume[] array = Object.FindObjectsOfType<LightProbeVolume>();
if (array.Length == 0)
{
return new List<Vector3>();
}
List<Vector3> list = new List<Vector3>();
for (int i = 0; i < array.Length; i++)
{
list.AddRange(array[i].CreatePositions());
}
return list;
}
private static List<Vector3> CreateAroundPointLights(float range)
{
List<Light> list = (from x in Object.FindObjectsOfType<Light>()
where (int)x.type == 2
select x).ToList();
if (list.Count == 0)
{
return new List<Vector3>();
}
List<Vector3> list2 = new List<Vector3>();
for (int i = 0; i < list.Count; i++)
{
list2.AddRange(CreatePositionsAround(((Component)list[i]).transform, range));
}
return list2;
}
private static List<Vector3> MergeClosestPositions(List<Vector3> positions, float distance, out int mergedCount)
{
//IL_00a2: 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_0127: 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_0153: 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_016e: 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_019d: Unknown result type (might be due to invalid IL or missing references)
if (positions == null)
{
mergedCount = 0;
return new List<Vector3>();
}
int count = positions.Count;
bool flag = false;
while (!flag)
{
Dictionary<Vector3, List<Vector3>> dictionary = new Dictionary<Vector3, List<Vector3>>();
for (int i = 0; i < positions.Count; i++)
{
List<Vector3> list = positions.Where(delegate(Vector3 x)
{
//IL_0000: 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_001c: Unknown result type (might be due to invalid IL or missing references)
Vector3 val2 = x - positions[i];
return ((Vector3)(ref val2)).magnitude < distance;
}).ToList();
if (list.Count > 0 && !dictionary.ContainsKey(positions[i]))
{
dictionary.Add(positions[i], list);
}
}
positions.Clear();
List<Vector3> list2 = dictionary.Keys.ToList();
for (int j = 0; j < list2.Count; j++)
{
Vector3 center = dictionary[list2[j]].Aggregate(Vector3.zero, (Vector3 result, Vector3 target) => result + target) / (float)dictionary[list2[j]].Count;
if (!positions.Exists((Vector3 x) => x == center))
{
positions.Add(center);
}
}
flag = positions.Select((Vector3 x) => positions.Where(delegate(Vector3 y)
{
//IL_0000: 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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
int result2;
if (y != x)
{
Vector3 val = y - x;
result2 = ((((Vector3)(ref val)).magnitude < distance) ? 1 : 0);
}
else
{
result2 = 0;
}
return (byte)result2 != 0;
})).All((IEnumerable<Vector3> x) => !x.Any());
}
mergedCount = count - positions.Count;
return positions;
}
public static List<Vector3> CreatePositionsAround(Transform transform, float range)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0071: 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_0091: 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_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_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0111: 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)
Vector3[] source = (Vector3[])(object)new Vector3[8]
{
new Vector3(-0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, 0.5f, 0.5f),
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, -0.5f)
};
return source.Select((Vector3 x) => transform.TransformPoint(x * range)).ToList();
}
}
public enum LightProbeVolumeType
{
Fixed,
Float
}
[AddComponentMenu("Rendering/Light Probe Volume")]
public class LightProbeVolume : TransformVolume
{
[SerializeField]
private LightProbeVolumeType m_type = LightProbeVolumeType.Fixed;
[SerializeField]
private Vector3 m_densityFixed = Vector3.one;
[SerializeField]
private Vector3 m_densityFloat = Vector3.one;
public LightProbeVolumeType Type
{
get
{
return m_type;
}
set
{
m_type = value;
}
}
public Vector3 Density
{
get
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
return (m_type != 0) ? m_densityFloat : m_densityFixed;
}
set
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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)
if (m_type == LightProbeVolumeType.Fixed)
{
m_densityFixed = value;
}
else
{
m_densityFloat = value;
}
}
}
public static Color EditorColor => new Color(1f, 0.9f, 0.25f);
public List<Vector3> CreatePositions()
{
return CreatePositions(m_type);
}
public List<Vector3> CreatePositions(LightProbeVolumeType type)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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_001a: Unknown result type (might be due to invalid IL or missing references)
return (type != 0) ? CreatePositionsFloat(((Component)this).transform, base.Origin, base.Size, Density) : CreatePositionsFixed(((Component)this).transform, base.Origin, base.Size, Density);
}
public static List<Vector3> CreatePositionsFixed(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>();
Vector3 val = origin;
float num = size.x / (float)Mathf.FloorToInt(density.x);
float num2 = size.y / (float)Mathf.FloorToInt(density.y);
float num3 = size.z / (float)Mathf.FloorToInt(density.z);
val -= size * 0.5f;
for (int i = 0; (float)i <= density.x; i++)
{
for (int j = 0; (float)j <= density.y; j++)
{
for (int k = 0; (float)k <= density.z; k++)
{
Vector3 val2 = val + new Vector3((float)i * num, (float)j * num2, (float)k * num3);
val2 = volumeTransform.TransformPoint(val2);
list.Add(val2);
}
}
}
return list;
}
public static List<Vector3> CreatePositionsFloat(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_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_00e9: 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_0118: 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_0122: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>();
Vector3 val = origin;
int num = Mathf.FloorToInt(size.x / density.x);
int num2 = Mathf.FloorToInt(size.y / density.y);
int num3 = Mathf.FloorToInt(size.z / density.z);
val -= size * 0.5f;
val.x += (size.x - (float)num * density.x) * 0.5f;
val.y += (size.y - (float)num2 * density.y) * 0.5f;
val.z += (size.z - (float)num3 * density.z) * 0.5f;
for (int i = 0; i <= num; i++)
{
for (int j = 0; j <= num2; j++)
{
for (int k = 0; k <= num3; k++)
{
Vector3 val2 = val + new Vector3((float)i * density.x, (float)j * density.y, (float)k * density.z);
val2 = volumeTransform.TransformPoint(val2);
list.Add(val2);
}
}
}
return list;
}
}
[AddComponentMenu("")]
public class TransformVolume : MonoBehaviour
{
[SerializeField]
private Volume m_volume = new Volume(Vector3.zero, Vector3.one);
public Volume Volume
{
get
{
return m_volume;
}
set
{
m_volume = value;
}
}
public Vector3 Origin => m_volume.Origin;
public Vector3 Size => m_volume.Size;
public bool IsInBounds(Vector3[] points)
{
//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_000c: Unknown result type (might be due to invalid IL or missing references)
Bounds bounds = GetBounds();
return ((Bounds)(ref bounds)).Intersects(GetBounds(points));
}
public bool IsOnBorder(Vector3[] points)
{
if (points.All((Vector3 x) => !IsInVolume(x)))
{
return false;
}
return !points.All(IsInVolume);
}
public bool IsInVolume(Vector3[] points)
{
return points.All(IsInVolume);
}
public bool IsInVolume(Vector3 position)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
Plane val = default(Plane);
for (int i = 0; i < 6; i++)
{
((Plane)(ref val))..ctor(GetSideDirection(i), GetSidePosition(i));
if (((Plane)(ref val)).GetSide(position))
{
return false;
}
}
return true;
}
public Vector3[] GetCorners()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_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_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_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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: 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)
Vector3[] array = (Vector3[])(object)new Vector3[8]
{
new Vector3(-0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, 0.5f, 0.5f),
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, -0.5f)
};
for (int i = 0; i < array.Length; i++)
{
ref Vector3 reference = ref array[i];
reference.x *= m_volume.Size.x;
ref Vector3 reference2 = ref array[i];
reference2.y *= m_volume.Size.y;
ref Vector3 reference3 = ref array[i];
reference3.z *= m_volume.Size.z;
ref Vector3 reference4 = ref array[i];
reference4 = ((Component)this).transform.TransformPoint(m_volume.Origin + array[i]);
}
return array;
}
public Bounds GetBounds()
{
//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)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
return GetBounds(GetCorners());
}
public Bounds GetBounds(Vector3[] points)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_006a: 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)
Vector3 val = points.Aggregate(Vector3.zero, (Vector3 result, Vector3 point) => result + point) / (float)points.Length;
Bounds result2 = default(Bounds);
((Bounds)(ref result2))..ctor(val, Vector3.zero);
for (int i = 0; i < points.Length; i++)
{
((Bounds)(ref result2)).Encapsulate(points[i]);
}
return result2;
}
public GameObject[] GetGameObjectsInBounds(LayerMask layerMask)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
MeshRenderer[] array = Object.FindObjectsOfType<MeshRenderer>();
List<GameObject> list = new List<GameObject>();
Bounds bounds = GetBounds();
for (int i = 0; i < array.Length; i++)
{
if (!((Object)(object)((Component)array[i]).gameObject == (Object)(object)((Component)((Component)this).transform).gameObject) && !((Object)(object)((Component)array[i]).GetComponent<TransformVolume>() != (Object)null) && ((1 << ((Component)array[i]).gameObject.layer) & ((LayerMask)(ref layerMask)).value) != 0 && ((Bounds)(ref bounds)).Intersects(((Renderer)array[i]).bounds))
{
list.Add(((Component)array[i]).gameObject);
}
}
return list.ToArray();
}
public Vector3 GetSideDirection(int side)
{
//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)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0053: 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_006c: 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_0084: 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_008e: 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)
Vector3[] array = (Vector3[])(object)new Vector3[6];
Vector3 right = Vector3.right;
Vector3 up = Vector3.up;
Vector3 forward = Vector3.forward;
array[0] = right;
ref Vector3 reference = ref array[1];
reference = -right;
array[2] = up;
ref Vector3 reference2 = ref array[3];
reference2 = -up;
array[4] = forward;
ref Vector3 reference3 = ref array[5];
reference3 = -forward;
return ((Component)this).transform.TransformDirection(array[side]);
}
public Vector3 GetSidePosition(int side)
{
//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)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0053: 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_006c: 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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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)
Vector3[] array = (Vector3[])(object)new Vector3[6];
Vector3 right = Vector3.right;
Vector3 up = Vector3.up;
Vector3 forward = Vector3.forward;
array[0] = right;
ref Vector3 reference = ref array[1];
reference = -right;
array[2] = up;
ref Vector3 reference2 = ref array[3];
reference2 = -up;
array[4] = forward;
ref Vector3 reference3 = ref array[5];
reference3 = -forward;
return ((Component)this).transform.TransformPoint(array[side] * GetSizeAxis(side) + m_volume.Origin);
}
public float GetSizeAxis(int side)
{
//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_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_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)
switch (side)
{
case 0:
case 1:
return m_volume.Size.x * 0.5f;
case 2:
case 3:
return m_volume.Size.y * 0.5f;
default:
return m_volume.Size.z * 0.5f;
}
}
public static Volume EditorVolumeControl(TransformVolume transformVolume, float handleSize, Color color)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: 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_00bc: Expected O, but got Unknown
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: 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_012a: 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_0102: Expected O, but got Unknown
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: 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_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Expected O, but got Unknown
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: 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_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_0307: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_0345: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_035a: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Expected O, but got Unknown
Vector3[] array = (Vector3[])(object)new Vector3[6];
Transform transform = ((Component)transformVolume).transform;
Handles.color = color;
for (int i = 0; i < array.Length; i++)
{
ref Vector3 reference = ref array[i];
reference = transformVolume.GetSidePosition(i);
}
ref Vector3 reference2 = ref array[0];
reference2 = Handles.Slider(array[0], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference3 = ref array[1];
reference3 = Handles.Slider(array[1], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference4 = ref array[2];
reference4 = Handles.Slider(array[2], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference5 = ref array[3];
reference5 = Handles.Slider(array[3], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference6 = ref array[4];
reference6 = Handles.Slider(array[4], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference7 = ref array[5];
reference7 = Handles.Slider(array[5], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
Vector3 origin = default(Vector3);
origin.x = transform.InverseTransformPoint((array[0] + array[1]) * 0.5f).x;
origin.y = transform.InverseTransformPoint((array[2] + array[3]) * 0.5f).y;
origin.z = transform.InverseTransformPoint((array[4] + array[5]) * 0.5f).z;
Vector3 size = default(Vector3);
size.x = transform.InverseTransformPoint(array[0]).x - transform.InverseTransformPoint(array[1]).x;
size.y = transform.InverseTransformPoint(array[2]).y - transform.InverseTransformPoint(array[3]).y;
size.z = transform.InverseTransformPoint(array[4]).z - transform.InverseTransformPoint(array[5]).z;
return new Volume(origin, size);
}
}
[Serializable]
public struct Volume
{
[SerializeField]
private Vector3 m_origin;
[SerializeField]
private Vector3 m_size;
public Vector3 Origin => m_origin;
public Vector3 Size => m_size;
public Volume(Vector3 origin, Vector3 size)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: 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_000a: Unknown result type (might be due to invalid IL or missing references)
m_origin = origin;
m_size = size;
}
public static bool operator ==(Volume left, Volume right)
{
return left.Equals(right);
}
public static bool operator !=(Volume left, Volume right)
{
return !left.Equals(right);
}
public bool Equals(Volume other)
{
//IL_0002: 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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
return Origin == other.Origin && Size == other.Size;
}
public override bool Equals(object obj)
{
if (object.ReferenceEquals(null, obj))
{
return false;
}
return obj is Volume && Equals((Volume)obj);
}
public override int GetHashCode()
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
Vector3 origin = Origin;
int num = ((object)(Vector3)(ref origin)).GetHashCode() * 397;
Vector3 size = Size;
return num ^ ((object)(Vector3)(ref size)).GetHashCode();
}
public override string ToString()
{
//IL_0007: 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)
return $"Origin: {Origin}, Size: {Size}";
}
}
}
namespace Technie.PhysicsCreator
{
public class AxisAlignedBoxFitter
{
public void Fit(Hull hull, Vector3[] meshVertices, int[] meshIndices)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
Vector3[] selectedVertices = FaceAlignmentBoxFitter.GetSelectedVertices(hull, meshVertices, meshIndices);
ConstructionPlane plane = new ConstructionPlane(Vector3.zero, Vector3.up, Vector3.right);
RotatedBox computedBox = RotatedBoxFitter.FindTightestBox(plane, selectedVertices);
RotatedBoxFitter.ApplyToHull(computedBox, hull);
}
}
public class Pose
{
public Vector3 forward;
public Vector3 up;
public Vector3 right;
}
public class Triangle
{
public Vector3 normal;
public float area;
public Vector3 center;
public Triangle(Vector3 p0, Vector3 p1, Vector3 p2)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0040: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
Vector3 val = p1 - p0;
Vector3 val2 = p2 - p0;
Vector3 val3 = Vector3.Cross(val, val2);
area = ((Vector3)(ref val3)).magnitude * 0.5f;
normal = ((Vector3)(ref val3)).normalized;
center = (p0 + p1 + p2) / 3f;
}
}
public class TriangleBucket
{
private List<Triangle> triangles;
private Vector3 averagedNormal;
private Vector3 averagedCenter;
private float totalArea;
public float Area => totalArea;
public TriangleBucket(Triangle initialTriangle)
{
triangles = new List<Triangle>();
triangles.Add(initialTriangle);
CalculateNormal();
CalcTotalArea();
}
public void Add(Triangle t)
{
triangles.Add(t);
CalculateNormal();
CalcTotalArea();
}
public void Add(TriangleBucket otherBucket)
{
foreach (Triangle triangle in otherBucket.triangles)
{
triangles.Add(triangle);
}
CalculateNormal();
CalcTotalArea();
}
private void CalculateNormal()
{
//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_0029: 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_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)
averagedNormal = Vector3.zero;
foreach (Triangle triangle in triangles)
{
averagedNormal += triangle.normal * triangle.area;
}
((Vector3)(ref averagedNormal)).Normalize();
}
public Vector3 GetAverageNormal()
{
//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_000d: Unknown result type (might be due to invalid IL or missing references)
return averagedNormal;
}
public Vector3 GetAverageCenter()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
return triangles[0].center;
}
private void CalcTotalArea()
{
totalArea = 0f;
foreach (Triangle triangle in triangles)
{
totalArea += triangle.area;
}
}
}
public class TriangleAreaSorter : IComparer<Triangle>
{
public int Compare(Triangle lhs, Triangle rhs)
{
if (lhs.area < rhs.area)
{
return 1;
}
if (lhs.area > rhs.area)
{
return -1;
}
return 0;
}
}
public class TriangleBucketSorter : IComparer<TriangleBucket>
{
public int Compare(TriangleBucket lhs, TriangleBucket rhs)
{
if (lhs.Area < rhs.Area)
{
return 1;
}
if (lhs.Area > rhs.Area)
{
return -1;
}
return 0;
}
}
public class FaceAlignmentBoxFitter
{
public void Fit(Hull hull, Vector3[] meshVertices, int[] meshIndices)
{
if (meshIndices.Length < 3)
{
return;
}
List<Triangle> list = FindTriangles(meshVertices, meshIndices, hull.selectedFaces);
list.Sort(new TriangleAreaSorter());
List<TriangleBucket> list2 = new List<TriangleBucket>();
foreach (Triangle item in list)
{
TriangleBucket triangleBucket = FindBestBucket(item, 30f, list2);
if (triangleBucket != null)
{
triangleBucket.Add(item);
continue;
}
triangleBucket = new TriangleBucket(item);
list2.Add(triangleBucket);
}
while (list2.Count > 3)
{
MergeClosestBuckets(list2);
}
list2.Sort(new TriangleBucketSorter());
Vector3[] selectedVertices = GetSelectedVertices(hull, meshVertices, meshIndices);
ConstructionPlane plane = CreateConstructionPlane(list2[0], (list2.Count <= 1) ? null : list2[1], (list2.Count <= 2) ? null : list2[2]);
RotatedBox computedBox = RotatedBoxFitter.FindTightestBox(plane, selectedVertices);
RotatedBoxFitter.ApplyToHull(computedBox, hull);
}
public static List<Triangle> FindTriangles(Vector3[] meshVertices, int[] meshIndices, List<int> selectedFaces)
{
//IL_003c: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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_0065: Unknown result type (might be due to invalid IL or missing references)
List<Triangle> list = new List<Triangle>();
foreach (int selectedFace in selectedFaces)
{
int num = meshIndices[selectedFace * 3];
int num2 = meshIndices[selectedFace * 3 + 1];
int num3 = meshIndices[selectedFace * 3 + 2];
Vector3 p = meshVertices[num];
Vector3 p2 = meshVertices[num2];
Vector3 p3 = meshVertices[num3];
Triangle item = new Triangle(p, p2, p3);
list.Add(item);
}
return list;
}
public static void FindTriangles(Hull hull, Vector3[] meshVertices, int[] meshIndices, out Vector3[] hullVertices, out int[] hullIndices)
{
//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_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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_0077: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>();
foreach (int selectedFace in hull.selectedFaces)
{
int num = meshIndices[selectedFace * 3];
int num2 = meshIndices[selectedFace * 3 + 1];
int num3 = meshIndices[selectedFace * 3 + 2];
Vector3 item = meshVertices[num];
Vector3 item2 = meshVertices[num2];
Vector3 item3 = meshVertices[num3];
list.Add(item);
list.Add(item2);
list.Add(item3);
}
hullVertices = list.ToArray();
hullIndices = new int[hullVertices.Length];
for (int i = 0; i < hullIndices.Length; i++)
{
hullIndices[i] = i;
}
}
public static Vector3[] GetSelectedVertices(Hull hull, Vector3[] meshVertices, int[] meshIndices)
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
Dictionary<int, int> dictionary = new Dictionary<int, int>();
foreach (int selectedFace in hull.selectedFaces)
{
int num = meshIndices[selectedFace * 3];
int num2 = meshIndices[selectedFace * 3 + 1];
int num3 = meshIndices[selectedFace * 3 + 2];
dictionary[num] = num;
dictionary[num2] = num2;
dictionary[num3] = num3;
}
List<Vector3> list = new List<Vector3>();
foreach (int key in dictionary.Keys)
{
list.Add(meshVertices[key]);
}
return list.ToArray();
}
private TriangleBucket FindBestBucket(Triangle tri, float thresholdAngleDeg, List<TriangleBucket> buckets)
{
//IL_0020: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
TriangleBucket result = null;
float num = float.PositiveInfinity;
foreach (TriangleBucket bucket in buckets)
{
float num2 = Vector3.Angle(tri.normal, bucket.GetAverageNormal());
if (num2 < thresholdAngleDeg && num2 < num)
{
num = num2;
result = bucket;
continue;
}
float num3 = Vector3.Angle(tri.normal * -1f, bucket.GetAverageNormal());
if (num3 < thresholdAngleDeg && num3 < num)
{
tri.normal *= -1f;
num = num3;
result = bucket;
}
}
return result;
}
private void MergeClosestBuckets(List<TriangleBucket> buckets)
{
//IL_0033: 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)
TriangleBucket triangleBucket = null;
TriangleBucket triangleBucket2 = null;
float num = float.PositiveInfinity;
for (int i = 0; i < buckets.Count; i++)
{
for (int j = i + 1; j < buckets.Count; j++)
{
TriangleBucket triangleBucket3 = buckets[i];
TriangleBucket triangleBucket4 = buckets[j];
float num2 = Vector3.Angle(triangleBucket3.GetAverageNormal(), triangleBucket4.GetAverageNormal());
if (num2 < num)
{
num = num2;
triangleBucket = triangleBucket3;
triangleBucket2 = triangleBucket4;
}
}
}
if (triangleBucket != null && triangleBucket2 != null)
{
buckets.Remove(triangleBucket2);
triangleBucket.Add(triangleBucket2);
}
}
private ConstructionPlane CreateConstructionPlane(TriangleBucket primaryBucket, TriangleBucket secondaryBucket, TriangleBucket tertiaryBucket)
{
//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_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_0052: 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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0072: 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_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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
if (primaryBucket != null && secondaryBucket != null)
{
Vector3 averageNormal = primaryBucket.GetAverageNormal();
Vector3 t = Vector3.Cross(averageNormal, secondaryBucket.GetAverageNormal());
Vector3 averageCenter = primaryBucket.GetAverageCenter();
return new ConstructionPlane(averageCenter, averageNormal, t);
}
if (primaryBucket != null)
{
Vector3 averageNormal2 = primaryBucket.GetAverageNormal();
Vector3 averageCenter2 = primaryBucket.GetAverageCenter();
Vector3 t2 = Vector3.Cross(averageNormal2, (!(Vector3.Dot(averageNormal2, Vector3.up) > 0.5f)) ? Vector3.up : Vector3.right);
return new ConstructionPlane(averageCenter2, averageNormal2, t2);
}
return null;
}
}
public class GizmoUtils
{
public static void ToggleGizmos(bool gizmosOn)
{
int num = (gizmosOn ? 1 : 0);
Assembly assembly = Assembly.GetAssembly(typeof(Editor));
Type type = assembly.GetType("UnityEditor.AnnotationUtility");
if ((object)type == null)
{
return;
}
MethodInfo method = type.GetMethod("GetAnnotations", BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo method2 = type.GetMethod("SetGizmoEnabled", BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo method3 = type.GetMethod("SetIconEnabled", BindingFlags.Static | BindingFlags.NonPublic);
object obj = method.Invoke(null, null);
foreach (object item in (IEnumerable)obj)
{
Type type2 = item.GetType();
FieldInfo field = type2.GetField("classID", BindingFlags.Instance | BindingFlags.Public);
FieldInfo field2 = type2.GetField("scriptClass", BindingFlags.Instance | BindingFlags.Public);
if ((object)field == null || (object)field2 == null)
{
continue;
}
int num2 = (int)field.GetValue(item);
string text = (string)field2.GetValue(item);
if (text == "HullPainter")
{
switch (method2.GetParameters().Length)
{
case 3:
method2.Invoke(null, new object[3] { num2, text, num });
break;
case 4:
method2.Invoke(null, new object[4] { num2, text, num, true });
break;
}
int num3 = method3.GetParameters().Length;
if (num3 == 3)
{
method3.Invoke(null, new object[3] { num2, text, num });
}
}
}
}
}
public class HullData : ScriptableObject
{
}
public class HullMapping
{
public Hull sourceHull;
public Collider generatedCollider;
public MeshCollider[] autoGeneratedColliders;
public HullPainterChild targetChild;
public HullPainterChild[] targetAutoGeneratedChilds;
public void AddAutoChild(HullPainterChild newChild, MeshCollider newCollider)
{
if ((Object)(object)newChild != (Object)null)
{
List<HullPainterChild> list = new List<HullPainterChild>();
if (targetAutoGeneratedChilds != null)
{
list.AddRange(targetAutoGeneratedChilds);
}
if (!list.Contains(newChild))
{
list.Add(newChild);
targetAutoGeneratedChilds = list.ToArray();
}
}
if ((Object)(object)newCollider != (Object)null)
{
List<MeshCollider> list2 = new List<MeshCollider>();
if (autoGeneratedColliders != null)
{
list2.AddRange(autoGeneratedColliders);
}
if (!list2.Contains(newCollider))
{
list2.Add(newCollider);
autoGeneratedColliders = list2.ToArray();
}
}
}
}
public class HullPainter : MonoBehaviour
{
public PaintingData paintingData;
public HullData hullData;
private List<HullMapping> hullMapping;
private Mesh debugMesh;
private void OnDestroy()
{
SceneView.RepaintAll();
}
public void CreateColliderComponents(Mesh[] autoHulls)
{
CreateHullMapping();
foreach (Hull hull in paintingData.hulls)
{
UpdateCollider(hull);
}
foreach (Hull hull2 in paintingData.hulls)
{
CreateAutoHulls(hull2, autoHulls);
}
}
public void RemoveAllColliders()
{
if (hullMapping == null)
{
return;
}
foreach (HullMapping item in hullMapping)
{
DestroyImmediateWithUndo((Object)(object)item.generatedCollider);
if (item.autoGeneratedColliders != null)
{
MeshCollider[] autoGeneratedColliders = item.autoGeneratedColliders;
foreach (MeshCollider obj in autoGeneratedColliders)
{
DestroyImmediateWithUndo((Object)(object)obj);
}
}
}
for (int num = hullMapping.Count - 1; num >= 0; num--)
{
if ((Object)(object)hullMapping[num].targetChild != (Object)null)
{
hullMapping.RemoveAt(num);
}
}
}
public void RemoveAllGenerated()
{
CreateHullMapping();
foreach (HullMapping item in hullMapping)
{
DestroyImmediateWithUndo((Object)(object)item.generatedCollider);
if ((Object)(object)item.targetChild != (Object)null)
{
DestroyImmediateWithUndo((Object)(object)((Component)item.targetChild).gameObject);
}
if (item.autoGeneratedColliders != null)
{
MeshCollider[] autoGeneratedColliders = item.autoGeneratedColliders;
foreach (MeshCollider obj in autoGeneratedColliders)
{
DestroyImmediateWithUndo((Object)(object)obj);
}
}
if (item.targetAutoGeneratedChilds == null)
{
continue;
}
HullPainterChild[] targetAutoGeneratedChilds = item.targetAutoGeneratedChilds;
foreach (HullPainterChild hullPainterChild in targetAutoGeneratedChilds)
{
GameObject gameObject = ((Component)hullPainterChild).gameObject;
DestroyImmediateWithUndo((Object)(object)hullPainterChild);
if (gameObject.transform.childCount == 0 && gameObject.GetComponents<Component>().Length == 1)
{
DestroyImmediateWithUndo((Object)(object)gameObject);
}
}
}
}
private static bool IsDeletable(GameObject obj)
{
Component[] components = obj.GetComponents<Component>();
int num = 0;
Component[] array = components;
foreach (Component val in array)
{
if (val is Transform || val is Collider || val is HullPainter || val is HullPainterChild)
{
num++;
}
}
return components.Length == num;
}
private static void DestroyImmediateWithUndo(Object obj)
{
if (!(obj == (Object)null))
{
Undo.DestroyObjectImmed