using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
using OtherLoader;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[Serializable]
[CreateAssetMenu(fileName = "New SlaughtomaticMaterialProfile", menuName = "Okkim/Slaughtomatic Material Profile", order = 1)]
public class SlaughtomaticMaterialProfile : ScriptableObject
{
private int materialWeightSum = 0;
public List<MaterialProfileEntry> materialProfileEntries;
[ContextMenu("ListPercentages")]
public void ListPercentages()
{
Debug.Log((object)("Material weight sum = " + materialWeightSum));
int num = 0;
foreach (MaterialProfileEntry materialProfileEntry in materialProfileEntries)
{
float num2 = (float)materialProfileEntry.weight / (float)materialWeightSum;
Debug.Log((object)("Material " + num + " = " + ((Object)materialProfileEntry.material).name + ", weight = " + materialProfileEntry.weight + ", chance to drop = " + (num2 * 100f).ToString("F4") + "%"));
num++;
}
}
private void OnValidate()
{
materialWeightSum = 0;
foreach (MaterialProfileEntry materialProfileEntry in materialProfileEntries)
{
if (materialProfileEntry != null)
{
materialWeightSum += materialProfileEntry.weight;
}
}
}
}
[Serializable]
public class MaterialProfileEntry
{
public Material material;
[Tooltip("The higher the value, the more often it shows up in-game")]
public int weight = 1;
public bool isRare;
}
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoDestructShuriken : MonoBehaviour
{
public bool OnlyDeactivate;
private void OnEnable()
{
((MonoBehaviour)this).StartCoroutine("CheckIfAlive");
}
private IEnumerator CheckIfAlive()
{
do
{
yield return (object)new WaitForSeconds(0.5f);
}
while (((Component)this).GetComponent<ParticleSystem>().IsAlive(true));
if (OnlyDeactivate)
{
((Component)this).gameObject.SetActive(false);
}
else
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
[RequireComponent(typeof(Light))]
public class CFX_LightIntensityFade : MonoBehaviour
{
public float duration = 1f;
public float delay = 0f;
public float finalIntensity = 0f;
private float baseIntensity;
public bool autodestruct;
private float p_lifetime = 0f;
private float p_delay;
private void Start()
{
baseIntensity = ((Component)this).GetComponent<Light>().intensity;
}
private void OnEnable()
{
p_lifetime = 0f;
p_delay = delay;
if (delay > 0f)
{
((Behaviour)((Component)this).GetComponent<Light>()).enabled = false;
}
}
private void Update()
{
if (p_delay > 0f)
{
p_delay -= Time.deltaTime;
if (p_delay <= 0f)
{
((Behaviour)((Component)this).GetComponent<Light>()).enabled = true;
}
}
else if (p_lifetime / duration < 1f)
{
((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration);
p_lifetime += Time.deltaTime;
}
else if (autodestruct)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
[RequireComponent(typeof(MeshFilter))]
public class WFX_BulletHoleDecal : MonoBehaviour
{
private static Vector2[] quadUVs = (Vector2[])(object)new Vector2[4]
{
new Vector2(0f, 0f),
new Vector2(0f, 1f),
new Vector2(1f, 0f),
new Vector2(1f, 1f)
};
public float lifetime = 10f;
public float fadeoutpercent = 80f;
public Vector2 frames;
public bool randomRotation = false;
public bool deactivate = false;
private float life;
private float fadeout;
private Color color;
private float orgAlpha;
private void Awake()
{
//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)
color = ((Component)this).GetComponent<Renderer>().material.GetColor("_TintColor");
orgAlpha = color.a;
}
private void OnEnable()
{
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
int num = Random.Range(0, (int)(frames.x * frames.y));
int num2 = (int)((float)num % frames.x);
int num3 = (int)((float)num / frames.y);
Vector2[] array = (Vector2[])(object)new Vector2[4];
for (int i = 0; i < 4; i++)
{
array[i].x = (quadUVs[i].x + (float)num2) * (1f / frames.x);
array[i].y = (quadUVs[i].y + (float)num3) * (1f / frames.y);
}
((Component)this).GetComponent<MeshFilter>().mesh.uv = array;
if (randomRotation)
{
((Component)this).transform.Rotate(0f, 0f, Random.Range(0f, 360f), (Space)1);
}
life = lifetime;
fadeout = life * (fadeoutpercent / 100f);
color.a = orgAlpha;
((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
((MonoBehaviour)this).StopAllCoroutines();
((MonoBehaviour)this).StartCoroutine("holeUpdate");
}
private IEnumerator holeUpdate()
{
while (life > 0f)
{
life -= Time.deltaTime;
if (life <= fadeout)
{
color.a = Mathf.Lerp(0f, orgAlpha, life / fadeout);
((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
}
yield return null;
}
}
}
[RequireComponent(typeof(Light))]
public class WFX_LightFlicker : MonoBehaviour
{
public float time = 0.05f;
private float timer;
private void Start()
{
timer = time;
((MonoBehaviour)this).StartCoroutine("Flicker");
}
private IEnumerator Flicker()
{
while (true)
{
((Behaviour)((Component)this).GetComponent<Light>()).enabled = !((Behaviour)((Component)this).GetComponent<Light>()).enabled;
do
{
timer -= Time.deltaTime;
yield return null;
}
while (timer > 0f);
timer = time;
}
}
}
[BepInPlugin("Modmas2023.Modmas_2023", "Modmas_2023", "27.0.1")]
[BepInProcess("h3vr.exe")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Modmas_2023Plugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
private void Awake()
{
LoadAssets();
}
private void LoadAssets()
{
OtherLoader.RegisterDirectLoad(BasePath, "Modmas2023.Modmas_2023", "", "", "modmas2023_flares", "");
OtherLoader.RegisterDirectLoad(BasePath, "Modmas2023.Modmas_2023", "", "", "modmas2023_days", "");
OtherLoader.RegisterDirectLoad(BasePath, "Modmas2023.Modmas_2023", "", "", "thefunny", "");
}
}
public class FollowTargetDebug : MonoBehaviour
{
public bool check;
private void OnLevelWasLoaded()
{
Debug.Log((object)("OnLevelWasLoaded, player head exists: " + GM.CurrentPlayerBody != null));
}
private void Awake()
{
Debug.Log((object)"OnAwake, player head exists: ");
}
private void Start()
{
Debug.Log((object)"Start, player head exists: ");
}
private void Update()
{
if (!check)
{
Debug.Log((object)"Update, player head exists: ");
}
check = true;
}
}
namespace Modmas2023.Modmas_2023;
public class MultiLatchGunCase : FVRPhysicalObject
{
public MultiLatchGunCaseCover Cover;
public MultiLatchGunCaseLatch[] Latches;
public Transform ScanVolume;
public LayerMask LM_Scan;
private bool m_isCaseClosed = true;
[SerializeField]
private List<Vector3> m_containedPositions = new List<Vector3>();
[SerializeField]
private List<Quaternion> m_containedRotations = new List<Quaternion>();
public override bool IsDistantGrabbable()
{
return m_isCaseClosed;
}
public void UpdateCaseState()
{
if (Latches.All((MultiLatchGunCaseLatch latch) => latch.IsOpen()))
{
if (m_isCaseClosed)
{
OpenCase();
}
}
else if (!m_isCaseClosed)
{
CloseCase();
}
}
private void OpenCase()
{
//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_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)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_0063: Unknown result type (might be due to invalid IL or missing references)
m_isCaseClosed = false;
for (int num = base.m_containedObjects.Count - 1; num >= 0; num--)
{
Vector3 val = ((Component)this).transform.TransformPoint(m_containedPositions[num]);
Quaternion val2 = ((Component)this).transform.rotation * m_containedRotations[num];
((Component)base.m_containedObjects[num]).transform.SetPositionAndRotation(val, val2);
((Component)base.m_containedObjects[num]).gameObject.SetActive(true);
((FVRPhysicalObject)this).DecontainOtherObject(base.m_containedObjects[num]);
m_containedPositions.RemoveAt(num);
m_containedRotations.RemoveAt(num);
}
}
private void CloseCase()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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)
m_isCaseClosed = true;
Collider[] array = Physics.OverlapBox(ScanVolume.position, ScanVolume.localScale * 0.5f, ScanVolume.rotation, LayerMask.op_Implicit(LM_Scan), (QueryTriggerInteraction)2);
for (int i = 0; i < array.Length; i++)
{
if ((Object)(object)((Component)((Component)array[i]).transform.root).GetComponent<FVRPhysicalObject>() != (Object)null)
{
FVRPhysicalObject component = ((Component)((Component)array[i]).transform.root).GetComponent<FVRPhysicalObject>();
if ((Object)(object)component != (Object)(object)this && !((FVRInteractiveObject)component).IsHeld && !Object.op_Implicit((Object)(object)component.QuickbeltSlot) && !component.IsKinematicLocked && !component.IsPivotLocked && !base.m_containedObjects.Contains(component))
{
((FVRPhysicalObject)this).ContainOtherObject(component);
}
}
}
}
public override void ContainOtherObject(FVRPhysicalObject o)
{
//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_001e: 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_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_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_004b: 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)
((FVRPhysicalObject)this).ContainOtherObject(o);
Vector3 item = ((Component)this).transform.InverseTransformPoint(((Component)o).transform.position);
m_containedPositions.Add(item);
Quaternion item2 = Quaternion.Inverse(((Component)this).transform.rotation) * ((Component)o).transform.rotation;
m_containedRotations.Add(item2);
}
public override void SetGenericVector3s(List<Vector3> vector3s)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
m_containedPositions.Clear();
for (int i = 0; i < vector3s.Count; i++)
{
m_containedPositions.Add(vector3s[i]);
}
}
public override void SetGenericRotations(List<Quaternion> rotations)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
m_containedRotations.Clear();
for (int i = 0; i < rotations.Count; i++)
{
m_containedRotations.Add(rotations[i]);
}
}
public override List<Vector3> GetGenericVector3s()
{
return m_containedPositions;
}
public override List<Quaternion> GetGenericRotations()
{
return m_containedRotations;
}
public override Dictionary<string, string> GetFlagDic()
{
Dictionary<string, string> flagDic = ((FVRPhysicalObject)this).GetFlagDic();
string key = "isCoverOpen";
string value = "false";
if (Cover.IsOpen())
{
value = "True";
}
flagDic.Add(key, value);
return flagDic;
}
public override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
string empty = string.Empty;
string empty2 = string.Empty;
empty = "isCoverOpen";
if (f.ContainsKey(empty))
{
empty2 = f[empty];
bool.TryParse(empty2, out var result);
Cover.SetOpenCloseState(result);
}
UpdateCaseState();
((FVRPhysicalObject)this).ConfigureFromFlagDic(f);
}
}
public class MultiLatchGunCaseCover : FVRInteractiveObject
{
public enum rotAxis
{
x,
y,
z
}
public MultiLatchGunCaseLatch[] latches;
public Transform Root;
private float rotAngle;
public rotAxis RotAxis;
public float OpenRot;
public float ClosedRot;
public float SnapThreshold = 5f;
private bool m_isOpen;
public bool IsOpen()
{
return m_isOpen;
}
public override bool IsInteractable()
{
return latches.All((MultiLatchGunCaseLatch latch) => latch.IsOpen());
}
public void SetOpenCloseState(bool isOpen)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (isOpen)
{
m_isOpen = true;
rotAngle = OpenRot;
((Component)this).transform.localEulerAngles = new Vector3(rotAngle, 0f, 0f);
}
else
{
m_isOpen = false;
rotAngle = ClosedRot;
((Component)this).transform.localEulerAngles = new Vector3(rotAngle, 0f, 0f);
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_000e: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0067: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).UpdateInteraction(hand);
Vector3 val = ((HandInput)(ref hand.Input)).Pos - ((Component)this).transform.position;
Vector3 val2 = Vector3.ProjectOnPlane(val, Root.right);
val = ((Vector3)(ref val2)).normalized;
Vector3 forward = ((Component)Root).transform.forward;
rotAngle = Mathf.Atan2(Vector3.Dot(Root.right, Vector3.Cross(forward, val)), Vector3.Dot(forward, val)) * 57.29578f;
if (rotAngle > 180f)
{
rotAngle -= 360f;
}
else if (rotAngle < -180f)
{
rotAngle += 360f;
}
rotAngle = Mathf.Clamp(rotAngle, Mathf.Min(OpenRot, ClosedRot), Mathf.Max(OpenRot, ClosedRot));
if (Mathf.Abs(rotAngle - ClosedRot) < SnapThreshold)
{
rotAngle = ClosedRot;
m_isOpen = false;
}
else if (Mathf.Abs(rotAngle - OpenRot) < SnapThreshold)
{
rotAngle = OpenRot;
m_isOpen = true;
}
else
{
m_isOpen = true;
}
switch (RotAxis)
{
case rotAxis.x:
((Component)this).transform.localEulerAngles = new Vector3(rotAngle, 0f, 0f);
break;
case rotAxis.y:
((Component)this).transform.localEulerAngles = new Vector3(0f, rotAngle, 0f);
break;
case rotAxis.z:
((Component)this).transform.localEulerAngles = new Vector3(0f, 0f, rotAngle);
break;
}
}
}
public class MultiLatchGunCaseLatch : FVRInteractiveObject
{
public MultiLatchGunCase Case;
public MultiLatchGunCaseCover Cover;
private bool m_isOpen;
public AudioEvent Latch_Open;
public AudioEvent Latch_Close;
public Vector3 rotClose;
public Vector3 rotOpen;
public bool IsOpen()
{
return m_isOpen;
}
public override void SimpleInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).SimpleInteraction(hand);
ToggleLatchState();
}
public override bool IsInteractable()
{
return !Cover.IsOpen() && ((FVRInteractiveObject)this).IsInteractable();
}
private void ToggleLatchState()
{
if (m_isOpen)
{
Close(playSound: true);
}
else
{
Open(playSound: true);
}
}
private void Close(bool playSound)
{
//IL_0014: 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)
m_isOpen = false;
SM.PlayGenericSound(Latch_Close, ((Component)this).transform.position);
((Component)this).transform.localEulerAngles = rotClose;
Case.UpdateCaseState();
}
private void Open(bool playSound)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
m_isOpen = true;
if (playSound)
{
SM.PlayGenericSound(Latch_Open, ((Component)this).transform.position);
}
((Component)this).transform.localEulerAngles = rotOpen;
Case.UpdateCaseState();
}
}
public class Nuke : MonoBehaviour, IFVRDamageable
{
[Header("Nuke-Specific Parameters")]
[SerializeField]
private float health = 10000f;
[SerializeField]
private GameObject mesh;
[Header("Explosion parameters")]
[SerializeField]
private AudioEvent explosionSound;
[Tooltip("What material the bomb is set to during the explosion.")]
[SerializeField]
private Material explosionMaterial;
[SerializeField]
private float expansionSpeed = 10f;
[SerializeField]
private GameObject[] enableOnExplode;
[SerializeField]
private GameObject[] disableOnExplode;
private bool hasExploded;
private IEnumerator expansionCoroutine;
private float bombScale = 1f;
public void Start()
{
expansionCoroutine = bombExpansion();
}
public void Damage(Damage d)
{
health -= d.Dam_TotalKinetic;
if ((health <= 0f || d.Dam_EMP > 0f) && !hasExploded)
{
hasExploded = true;
Detonate();
}
}
private void Detonate()
{
//IL_000e: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//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)
SM.PlayCoreSound((FVRPooledAudioType)5, explosionSound, ((Component)this).transform.position);
ScreenShake.TriggerShake(new ShakeProfile(3.5f, 0.4f), new VignetteProfile(3.4f, 1f, 0.35f, Color.black));
if (enableOnExplode.Length > 0)
{
GameObject[] array = enableOnExplode;
foreach (GameObject val in array)
{
val.SetActive(true);
}
}
if (disableOnExplode.Length > 0)
{
GameObject[] array2 = disableOnExplode;
foreach (GameObject val2 in array2)
{
val2.SetActive(false);
}
}
if ((Object)(object)mesh.GetComponent<MeshRenderer>() != (Object)null && (Object)(object)explosionMaterial != (Object)null)
{
((Renderer)mesh.GetComponent<MeshRenderer>()).material = explosionMaterial;
((MonoBehaviour)this).StartCoroutine(expansionCoroutine);
}
Scene activeScene = SceneManager.GetActiveScene();
SteamVR_LoadLevel.Begin(((Scene)(ref activeScene)).name, false, 0.1f, 0f, 0f, 0f, 1f);
}
private IEnumerator bombExpansion()
{
while (true)
{
bombScale += expansionSpeed * Time.deltaTime;
mesh.transform.localScale = new Vector3(bombScale, bombScale, bombScale);
yield return null;
}
}
}
public class ExtrudeRandomEdges : MonoBehaviour
{
private pb_Object pb;
private pb_Face lastExtrudedFace = null;
public float distance = 1f;
private void Start()
{
pb = pb_ShapeGenerator.PlaneGenerator(1f, 1f, 0, 0, (Axis)2, false);
pb.SetFaceMaterial(pb.faces, pb_Constant.DefaultMaterial);
lastExtrudedFace = pb.faces[0];
}
private void OnGUI()
{
if (GUILayout.Button("Extrude Random Edge", (GUILayoutOption[])(object)new GUILayoutOption[0]))
{
ExtrudeEdge();
}
}
private void ExtrudeEdge()
{
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: 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_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: 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_016c: 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)
pb_Face sourceFace = lastExtrudedFace;
List<pb_WingedEdge> wingedEdges = pb_WingedEdge.GetWingedEdges(pb, false);
IEnumerable<pb_WingedEdge> source = wingedEdges.Where((pb_WingedEdge x) => x.face == sourceFace);
List<pb_Edge> list = (from x in source
where x.opposite == null
select x into y
select y.edge.local).ToList();
int index = Random.Range(0, list.Count);
pb_Edge val = list[index];
Vector3 val2 = (pb.vertices[val.x] + pb.vertices[val.y]) * 0.5f - pb_Math.Average<int>((IList<int>)sourceFace.distinctIndices, (Func<int, Vector3>)((int x) => pb.vertices[x]), (IList<int>)null);
((Vector3)(ref val2)).Normalize();
pb_Edge[] selectedEdges = default(pb_Edge[]);
pbMeshOps.Extrude(pb, (pb_Edge[])(object)new pb_Edge[1] { val }, 0f, false, true, ref selectedEdges);
lastExtrudedFace = pb.faces.Last();
pb.SetSelectedEdges((IEnumerable<pb_Edge>)selectedEdges);
pb_Object_Utility.TranslateVertices(pb, pb.SelectedTriangles, val2 * distance);
pb.ToMesh();
pb.Refresh((RefreshMask)255);
}
}
public class HighlightNearestFace : MonoBehaviour
{
public float travel = 50f;
public float speed = 0.2f;
private pb_Object target;
private pb_Face nearest = null;
private void Start()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
target = pb_ShapeGenerator.PlaneGenerator(travel, travel, 25, 25, (Axis)2, false);
target.SetFaceMaterial(target.faces, pb_Constant.DefaultMaterial);
((Component)target).transform.position = new Vector3(travel * 0.5f, 0f, travel * 0.5f);
target.ToMesh();
target.Refresh((RefreshMask)255);
Camera main = Camera.main;
((Component)main).transform.position = new Vector3(25f, 40f, 0f);
((Component)main).transform.localRotation = Quaternion.Euler(new Vector3(65f, 0f, 0f));
}
private void Update()
{
//IL_0048: 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_008a: 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_00dd: 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_013d: Unknown result type (might be due to invalid IL or missing references)
float num = Time.time * speed;
Vector3 position = default(Vector3);
((Vector3)(ref position))..ctor(Mathf.PerlinNoise(num, num) * travel, 2f, Mathf.PerlinNoise(num + 1f, num + 1f) * travel);
((Component)this).transform.position = position;
if ((Object)(object)target == (Object)null)
{
Debug.LogWarning((object)"Missing the ProBuilder Mesh target!");
return;
}
Vector3 val = ((Component)target).transform.InverseTransformPoint(((Component)this).transform.position);
if (nearest != null)
{
target.SetFaceColor(nearest, Color.white);
}
int num2 = target.faces.Length;
float num3 = float.PositiveInfinity;
nearest = target.faces[0];
for (int i = 0; i < num2; i++)
{
float num4 = Vector3.Distance(val, FaceCenter(target, target.faces[i]));
if (num4 < num3)
{
num3 = num4;
nearest = target.faces[i];
}
}
target.SetFaceColor(nearest, Color.blue);
target.RefreshColors();
}
private Vector3 FaceCenter(pb_Object pb, pb_Face face)
{
//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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
Vector3[] vertices = pb.vertices;
Vector3 zero = Vector3.zero;
int[] distinctIndices = face.distinctIndices;
foreach (int num in distinctIndices)
{
zero.x += vertices[num].x;
zero.y += vertices[num].y;
zero.z += vertices[num].z;
}
float num2 = face.distinctIndices.Length;
zero.x /= num2;
zero.y /= num2;
zero.z /= num2;
return zero;
}
}