Decompiled source of Modmas 2026 v1.0.0

Modmas_2026.dll

Decompiled a day ago
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 Atlas;
using Atlas.MappingComponents.Sandbox;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using NGA;
using Sodalite.Api;
using Sodalite.Utilities;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Alloy
{
	public static class EnumExtension
	{
		public static bool HasFlag(this Enum keys, Enum flag)
		{
			int num = Convert.ToInt32(keys);
			int num2 = Convert.ToInt32(flag);
			return (num & num2) == num2;
		}
	}
}
namespace Modmas2025
{
	public class MallPASystem : MonoBehaviour
	{
		private bool isDisabled;

		public AudioSource[] speakers;

		[Tooltip("Amt of silence (in seconds) between song and announcement.")]
		public float soundClipGracePeriod = 1f;

		private float silenceTimer;

		public float songVolume;

		public float psaVolume;

		public List<AudioClip> songs;

		public List<AudioClip> announcements;

		private int songIndex;

		private int announcementIndex;

		private bool isCurrentClipASong;

		public bool UsesPAClips = false;

		private void Awake()
		{
			IListExtensions.Shuffle<AudioClip>((IList<AudioClip>)songs);
			if (UsesPAClips)
			{
				IListExtensions.Shuffle<AudioClip>((IList<AudioClip>)announcements);
			}
			PlaySong();
		}

		private void Update()
		{
			if (speakers[0].isPlaying)
			{
				return;
			}
			silenceTimer += Time.deltaTime;
			if (silenceTimer >= soundClipGracePeriod)
			{
				silenceTimer = 0f;
				if (UsesPAClips && isCurrentClipASong)
				{
					PlayAnnouncement();
				}
				else
				{
					PlaySong();
				}
			}
		}

		private void PlaySong()
		{
			isCurrentClipASong = true;
			for (int i = 0; i < speakers.Length; i++)
			{
				speakers[i].volume = songVolume;
				speakers[i].PlayOneShot(songs[songIndex]);
			}
			songIndex++;
			if (songIndex >= songs.Count)
			{
				songIndex = 0;
			}
		}

		private void PlayAnnouncement()
		{
			isCurrentClipASong = false;
			for (int i = 0; i < speakers.Length; i++)
			{
				speakers[i].volume = psaVolume;
				speakers[i].PlayOneShot(announcements[announcementIndex]);
			}
			announcementIndex++;
			if (announcementIndex >= announcements.Count)
			{
				announcementIndex = 0;
			}
		}

		private void TurnOff()
		{
			for (int i = 0; i < speakers.Length; i++)
			{
				speakers[i].Stop();
			}
		}

		private void OnDisable()
		{
			TurnOff();
		}
	}
}
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace Modmas2026.Modmas_2026
{
	[BepInPlugin("Modmas2026.Modmas_2026", "Modmas_2026", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("nrgill28.Atlas", "1.0.1")]
	public class Modmas_2026Plugin : 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()
		{
			AtlasPlugin.RegisterScene(Path.Combine(BasePath, "waronxmas"));
		}
	}
}
namespace Modmas26
{
	public class Modmas26AmmoBoxSpawner : MonoBehaviour
	{
		private float Delay = 3f;

		public FireArmRoundType Type;

		public FireArmRoundClass Class;

		private bool HasSpawned = false;

		public void SpawnBox()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_002d: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			FireArmRoundType type = Type;
			FireArmRoundClass val = Class;
			GameObject ammoBox = AM.GetAmmoBox(Type);
			GameObject val2 = Object.Instantiate<GameObject>(ammoBox, ((Component)this).transform.position, ((Component)this).transform.rotation);
			CartridgeBox component = val2.GetComponent<CartridgeBox>();
			component.ConfigureShapeForRoundType(type, val);
		}

		private void Update()
		{
			Delay -= Time.deltaTime;
			if (Delay < 0f && !HasSpawned)
			{
				SpawnBox();
				HasSpawned = true;
			}
		}
	}
	public class Modmas26BattlefieldButton : FVRInteractiveObject
	{
		public GameObject Bf;

		public GameObject OtherThing;

		public Animator Anim;

		public string PressAnim;

		public AudioEvent Sound;

		public FVRPooledAudioType Type = (FVRPooledAudioType)11;

		public override void SimpleInteraction(FVRViveHand hand)
		{
			//IL_003a: 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)
			bool activeInHierarchy = Bf.activeInHierarchy;
			Bf.SetActive(!activeInHierarchy);
			OtherThing.SetActive(false);
			Anim.Play(PressAnim);
			SM.PlayCoreSound(Type, Sound, ((Component)this).transform.position);
		}
	}
	public class Modmas26GiftSpawner : MonoBehaviour
	{
		public ModmasHintBoard HintBoard;

		public int GiftNumber;

		public string GiftID;

		private float WaitDelay = 2f;

		private bool HasTaggedItem = false;

		public void TagItem()
		{
			if (HasTaggedItem)
			{
				return;
			}
			FVRPhysicalObject[] array = Object.FindObjectsOfType<FVRPhysicalObject>();
			FVRPhysicalObject[] array2 = array;
			foreach (FVRPhysicalObject val in array2)
			{
				if ((Object)(object)val.ObjectWrapper != (Object)null && val.ObjectWrapper.ItemID == GiftID)
				{
					Modmas26ItemGrabChecker modmas26ItemGrabChecker = ((Component)val).GetComponent<Modmas26ItemGrabChecker>();
					if ((Object)(object)modmas26ItemGrabChecker == (Object)null)
					{
						modmas26ItemGrabChecker = ((Component)val).gameObject.AddComponent<Modmas26ItemGrabChecker>();
					}
					modmas26ItemGrabChecker.HintBoard = HintBoard;
					modmas26ItemGrabChecker.HintIndex = GiftNumber;
					modmas26ItemGrabChecker.PO = val;
					HasTaggedItem = true;
					break;
				}
			}
		}

		private void Update()
		{
			if (!HasTaggedItem)
			{
				if (WaitDelay > 0f)
				{
					WaitDelay -= Time.deltaTime;
				}
				else
				{
					TagItem();
				}
			}
		}
	}
	public class Modmas26GiftSpawnerShootable : MonoBehaviour, IFVRDamageable
	{
		public ModmasHintBoard HintBoard;

		public int GiftNumber;

		public string GiftID;

		public ObjectSpawnPoint OSP;

		private float WaitDelay = 0.5f;

		private bool HasTaggedItem = false;

		private bool hasBeenShot = false;

		private bool hasSpawnedItem = false;

		public ParticleSystem PSys;

		public int NumParticles = 1;

		public AudioSource ASource;

		public AudioClip AClip;

		public void TagItem()
		{
			if (HasTaggedItem)
			{
				return;
			}
			FVRPhysicalObject[] array = Object.FindObjectsOfType<FVRPhysicalObject>();
			FVRPhysicalObject[] array2 = array;
			foreach (FVRPhysicalObject val in array2)
			{
				if ((Object)(object)val.ObjectWrapper != (Object)null && val.ObjectWrapper.ItemID == GiftID)
				{
					Modmas26ItemGrabChecker modmas26ItemGrabChecker = ((Component)val).GetComponent<Modmas26ItemGrabChecker>();
					if ((Object)(object)modmas26ItemGrabChecker == (Object)null)
					{
						modmas26ItemGrabChecker = ((Component)val).gameObject.AddComponent<Modmas26ItemGrabChecker>();
					}
					modmas26ItemGrabChecker.HintBoard = HintBoard;
					modmas26ItemGrabChecker.HintIndex = GiftNumber;
					modmas26ItemGrabChecker.PO = val;
					HasTaggedItem = true;
					break;
				}
			}
		}

		public void Damage(Damage d)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			if (((int)d.Class == 1 || (int)d.Class == 2 || (int)d.Class == 3) && (d.Dam_TotalKinetic > 0.5f || d.Dam_TotalEnergetic > 0.5f) && !hasBeenShot)
			{
				hasBeenShot = true;
				ASource.PlayOneShot(AClip);
				PSys.Emit(NumParticles);
			}
		}

		private void Update()
		{
			if (HasTaggedItem || !hasBeenShot)
			{
				return;
			}
			if (hasBeenShot && WaitDelay > 0f)
			{
				if (!hasSpawnedItem)
				{
					hasSpawnedItem = true;
					OSP.Spawn();
				}
				WaitDelay -= Time.deltaTime;
			}
			else
			{
				TagItem();
			}
		}
	}
	public class Modmas26ItemGrabChecker : MonoBehaviour
	{
		public ModmasHintBoard HintBoard;

		public int HintIndex;

		public FVRPhysicalObject PO;

		private bool HasBeenFound = false;

		private void Update()
		{
			if (!HasBeenFound && (Object)(object)PO != (Object)null && ((FVRInteractiveObject)PO).IsHeld && (Object)(object)HintBoard != (Object)null)
			{
				HintBoard.MakeGiftFound(HintIndex);
				HasBeenFound = true;
			}
		}
	}
}
public class ModmasBattlefield : MonoBehaviour
{
	private bool canSpawn;

	[SerializeField]
	private Transform assaultVolume;

	[SerializeField]
	private ModmasBattlefieldTeam[] teams;

	[SerializeField]
	private float SpawnDelay = 1f;

	private int teamindex;

	private bool hasDied = false;

	private Vector3 playerPos;

	private void Update()
	{
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Invalid comparison between Unknown and I4
		if (!canSpawn || (Object)(object)GM.CurrentPlayerBody == (Object)null)
		{
			return;
		}
		if (GM.CurrentPlayerBody.Health <= 0f)
		{
			hasDied = true;
			DisableArena();
		}
		else if (hasDied && GM.CurrentPlayerBody.Health > 0f)
		{
			hasDied = false;
		}
		SpawnTeam(teams[teamindex]);
		for (int i = 0; i < teams[teamindex].spawnedSosigs.Count; i++)
		{
			if ((int)teams[teamindex].spawnedSosigs[i].BodyState == 3)
			{
				teams[teamindex].spawnedSosigs[i].TickDownToClear(4f);
				teams[teamindex].spawnedSosigs.Remove(teams[teamindex].spawnedSosigs[i]);
			}
		}
		teamindex++;
		teamindex %= teams.Length;
	}

	private void SpawnTeam(ModmasBattlefieldTeam team)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		playerPos = GM.CurrentPlayerRoot.position - Vector3.down;
		if (team.spawnedSosigs.Count <= team.maxSosigs && team.spawnTimer <= Time.time)
		{
			SpawnSosig(SodaliteUtils.GetRandom<Transform>((IList<Transform>)team.spawnPoints), SodaliteUtils.GetRandom<int>((IList<int>)team.sosigID), team);
			team.spawnTimer = SpawnDelay + Time.time;
		}
	}

	private void SpawnSosig(Transform sp, int id, ModmasBattlefieldTeam team)
	{
		//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_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Expected O, but got Unknown
		//IL_0038: 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_005d: 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_009c: 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)
		Vector3 spawnPositionInArea = GetSpawnPositionInArea(sp);
		SpawnOptions val = new SpawnOptions();
		val.SpawnState = (SosigOrder)7;
		val.SpawnActivated = true;
		val.EquipmentMode = (EquipmentSlots)7;
		val.SpawnWithFullAmmo = true;
		val.IFF = team.sosigIFF;
		val.SosigTargetPosition = spawnPositionInArea;
		val.SosigTargetRotation = sp.eulerAngles;
		SpawnOptions val2 = val;
		Sosig val3 = SosigAPI.Spawn(ManagerSingleton<IM>.Instance.odicSosigObjsByID[(SosigEnemyID)id], val2, spawnPositionInArea, sp.rotation);
		if ((Object)(object)team.speechSetOverride != (Object)null)
		{
			val3.Speech = team.speechSetOverride;
		}
		team.spawnedSosigs.Add(val3);
		val3.CommandAssaultPoint(GetValidNavPosition(RandomNavPointInVolume(assaultVolume), 5f));
	}

	private void OnDrawGizmos()
	{
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: 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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		ModmasBattlefieldTeam[] array = teams;
		Vector3 val2 = default(Vector3);
		foreach (ModmasBattlefieldTeam modmasBattlefieldTeam in array)
		{
			Transform[] spawnPoints = modmasBattlefieldTeam.spawnPoints;
			foreach (Transform val in spawnPoints)
			{
				Gizmos.matrix = Matrix4x4.identity;
				Gizmos.color = new Color(1f, 0.105f, 0.105f, 0.8f);
				Gizmos.DrawLine(val.position, val.position + val.forward + Vector3.up * 0.125f);
				Gizmos.DrawSphere(val.position + Vector3.up * 0.125f, 0.25f);
				Gizmos.DrawSphere(val.position + Vector3.up, 0.25f);
				Gizmos.DrawSphere(val.position + Vector3.up * 1.75f, 0.25f);
				((Vector3)(ref val2))..ctor(val.localScale.x, 0.1f, val.localScale.z);
				Gizmos.matrix = Matrix4x4.TRS(val.position, Quaternion.identity, val2);
				Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
			}
		}
		Gizmos.matrix = Matrix4x4.identity;
		Gizmos.color = new Color(0.105f, 1f, 0.105f, 0.8f);
		Vector3 val3 = default(Vector3);
		((Vector3)(ref val3))..ctor(assaultVolume.localScale.x, 0.1f, assaultVolume.localScale.z);
		Gizmos.matrix = Matrix4x4.TRS(assaultVolume.position, Quaternion.identity, val3);
		Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
	}

	private void DisableArena()
	{
		canSpawn = false;
		for (int i = 0; i < teams.Length; i++)
		{
			if (teams[i].spawnedSosigs.Count <= 0)
			{
				continue;
			}
			foreach (Sosig spawnedSosig in teams[i].spawnedSosigs)
			{
				spawnedSosig.DeSpawnSosig();
			}
			teams[i].spawnedSosigs.Clear();
		}
	}

	private void OnEnable()
	{
		canSpawn = true;
	}

	private void OnDisable()
	{
		DisableArena();
	}

	private Vector3 GetSpawnPositionInArea(Transform transform)
	{
		//IL_0004: 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_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)
		//IL_001f: 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_0073: 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_007e: 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_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		Vector3 position = transform.position + Vector3.up * 1.7f;
		Vector3 val = transform.localScale / 2f;
		position.x += Random.Range(0f - val.x, val.x);
		position.z += Random.Range(0f - val.z, val.z);
		return GetValidNavPosition(position, 2f);
	}

	public static Vector3 RandomNavPointInVolume(Transform volume)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0019: 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)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: 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_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		Vector3 position = volume.position;
		Vector3 val = volume.localScale * 0.5f;
		Vector3 val2 = Vector3.Scale(val, volume.lossyScale);
		float num = Random.Range(0f - val2.x, val2.x);
		float num2 = Random.Range(0f - val2.y, val2.y);
		float num3 = Random.Range(0f - val2.z, val2.z);
		return position + volume.right * num + volume.up * num2 + volume.forward * num3;
	}

	public static Vector3 GetClosestValidDownPoint(Vector3 point)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0018: 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_0026: 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)
		RaycastHit val = default(RaycastHit);
		Physics.Raycast(point, Vector3.down, ref val);
		point = ((RaycastHit)(ref val)).point;
		point = GetValidNavPosition(point, 2f);
		return point;
	}

	public static Vector3 GetValidNavPosition(Vector3 position, float distance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0025: Unknown result type (might be due to invalid IL or missing references)
		NavMeshHit val = default(NavMeshHit);
		if (NavMesh.SamplePosition(position, ref val, distance, -1))
		{
			return ((NavMeshHit)(ref val)).position;
		}
		return position;
	}
}
[Serializable]
public class ModmasBattlefieldTeam
{
	public SosigSpeechSet speechSetOverride;

	public Transform[] spawnPoints;

	public int maxSosigs;

	public int[] sosigID;

	public int sosigIFF;

	[HideInInspector]
	public float spawnTimer;

	[HideInInspector]
	public List<Sosig> spawnedSosigs = new List<Sosig>();
}
public class ModmasCivvieManager : MonoBehaviour
{
	[SerializeField]
	private int pathPointsAmmount = 20;

	[SerializeField]
	private Vector2 lingerTime = new Vector2(4f, 8f);

	[SerializeField]
	private float respawnTime = 5f;

	[SerializeField]
	private ModmasCivvie[] civvies;

	[SerializeField]
	private Transform[] wanderVolumes;

	[SerializeField]
	private Transform[] spawnVolumes;

	[SerializeField]
	private LayerMask navPointLayerMask = LayerMask.op_Implicit(-1);

	[SerializeField]
	private Color wanderGizmoColor = Color.green;

	[SerializeField]
	private Color spawnGizmoColor = Color.yellow;

	private int sosindex;

	private void Update()
	{
		ModmasCivvie[] array = civvies;
		foreach (ModmasCivvie sos in array)
		{
			UpdateSosig(sos);
		}
	}

	private void FixedUpdate()
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Invalid comparison between Unknown and I4
		if (civvies[sosindex].respawntimestamp <= Time.time)
		{
			SpawnSosig(civvies[sosindex]);
		}
		if ((Object)(object)civvies[sosindex].mySos != (Object)null && (int)civvies[sosindex].mySos.BodyState == 3)
		{
			civvies[sosindex].mySos.TickDownToClear(respawnTime);
			civvies[sosindex].mySos = null;
			civvies[sosindex].respawntimestamp = Time.time + respawnTime;
		}
		sosindex = (sosindex + 1) % civvies.Length;
	}

	private void OnDisable()
	{
		ModmasCivvie[] array = civvies;
		foreach (ModmasCivvie modmasCivvie in array)
		{
			if ((Object)(object)modmasCivvie.mySos != (Object)null)
			{
				modmasCivvie.mySos.DeSpawnSosig();
			}
			modmasCivvie.respawntimestamp = -1f;
		}
		sosindex = 0;
	}

	private void SpawnSosig(ModmasCivvie civvie)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: 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_004c: Expected O, but got Unknown
		//IL_0076: 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_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: 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_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: 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)
		Transform volume = spawnVolumes[Random.Range(0, spawnVolumes.Length)];
		Vector3 closestValidDownNavPosition = GetClosestValidDownNavPosition(RandomPositionInVolume(volume));
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(0f, Random.Range(0f, 359f), 0f);
		SpawnOptions val2 = new SpawnOptions();
		val2.SpawnState = (SosigOrder)6;
		val2.SpawnActivated = true;
		val2.EquipmentMode = (EquipmentSlots)7;
		val2.SpawnWithFullAmmo = true;
		val2.IFF = -1;
		val2.SosigTargetPosition = closestValidDownNavPosition;
		val2.SosigTargetRotation = val;
		SpawnOptions val3 = val2;
		civvie.mySos = SosigAPI.Spawn(ManagerSingleton<IM>.Instance.odicSosigObjsByID[(SosigEnemyID)civvie.id], val3, closestValidDownNavPosition, Quaternion.Euler(val));
		((Component)civvie.mySos).GetComponent<NavMeshAgent>().obstacleAvoidanceType = (ObstacleAvoidanceType)1;
		if ((Object)(object)civvie.speechSetOverride != (Object)null)
		{
			civvie.mySos.Speech = civvie.speechSetOverride;
		}
		civvie.mySos.IgnoresNeedForWeapons = true;
		civvie.respawntimestamp = float.PositiveInfinity;
		if (civvie.pathPositions == null || civvie.pathPositions.Count <= 0)
		{
			for (int i = 0; i < pathPointsAmmount; i++)
			{
				Transform volume2 = wanderVolumes[Random.Range(0, wanderVolumes.Length)];
				civvie.pathPositions.Add(GetClosestValidDownNavPosition(RandomPositionInVolume(volume2)));
				civvie.pathRotations.Add(new Vector3(0f, Random.Range(0f, 359f), 0f));
			}
		}
		civvie.mySos.CommandPathTo(civvie.pathPositions, civvie.pathRotations, 1f, lingerTime, 2f, (SosigMoveSpeed)3, (PathLoopType)7, (List<Sosig>)null, 0.2f, 1f, false, 50f);
		UpdateSosig(civvie);
	}

	private void UpdateSosig(ModmasCivvie sos)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Invalid comparison between Unknown and I4
		if ((Object)(object)sos.mySos != (Object)null && (Object)(object)sos.speechSetOverride != (Object)null && sos.mySos.CanSpeakState() && (int)sos.mySos.CurrentOrder == 10)
		{
			sos.mySos.Speak_State(sos.speechSetOverride.OnWander);
		}
	}

	private Vector3 GetSpawnPositionInArea(Transform transform)
	{
		//IL_0004: 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_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)
		//IL_001f: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		Vector3 position = transform.position + Vector3.up * 1.7f;
		Vector3 val = transform.localScale / 2f;
		position.x += Random.Range(0f - val.x, val.x);
		position.z += Random.Range(0f - val.z, val.z);
		return GetValidNavPosition(position, 2f);
	}

	private Vector3 RandomPositionInVolume(Transform volume)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0019: 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)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: 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_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		Vector3 position = volume.position;
		Vector3 val = volume.localScale * 0.5f;
		Vector3 val2 = Vector3.Scale(val, volume.lossyScale);
		float num = Random.Range(0f - val2.x, val2.x);
		float num2 = Random.Range(0f - val2.y, val2.y);
		float num3 = Random.Range(0f - val2.z, val2.z);
		return position + volume.right * num + volume.up * num2 + volume.forward * num3;
	}

	private Vector3 GetClosestValidDownNavPosition(Vector3 point)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: 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_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_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_0027: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit val = default(RaycastHit);
		if (Physics.Raycast(point, Vector3.down, ref val, 50f, LayerMask.op_Implicit(navPointLayerMask)))
		{
			return GetValidNavPosition(((RaycastHit)(ref val)).point, 10f);
		}
		return GetValidNavPosition(point, 10f);
	}

	private Vector3 GetValidNavPosition(Vector3 position, float distance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0025: Unknown result type (might be due to invalid IL or missing references)
		NavMeshHit val = default(NavMeshHit);
		if (NavMesh.SamplePosition(position, ref val, distance, -1))
		{
			return ((NavMeshHit)(ref val)).position;
		}
		return position;
	}

	private void OnDrawGizmos()
	{
		//IL_001b: 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_00d9: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: 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_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: 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_010d: 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_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: 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_0161: 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)
		if (spawnVolumes != null && spawnVolumes.Length > 0)
		{
			Matrix4x4 matrix = Gizmos.matrix;
			Transform[] array = spawnVolumes;
			foreach (Transform val in array)
			{
				if (!((Object)(object)val == (Object)null))
				{
					Gizmos.matrix = val.localToWorldMatrix;
					Gizmos.color = new Color(spawnGizmoColor.r, spawnGizmoColor.g, spawnGizmoColor.b, 0.15f);
					Gizmos.DrawCube(Vector3.zero, Vector3.one);
					Gizmos.color = spawnGizmoColor;
					Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
				}
			}
			Gizmos.matrix = matrix;
		}
		if (wanderVolumes == null || wanderVolumes.Length <= 0)
		{
			return;
		}
		Matrix4x4 matrix2 = Gizmos.matrix;
		Transform[] array2 = wanderVolumes;
		foreach (Transform val2 in array2)
		{
			if (!((Object)(object)val2 == (Object)null))
			{
				Gizmos.matrix = val2.localToWorldMatrix;
				Gizmos.color = new Color(wanderGizmoColor.r, wanderGizmoColor.g, wanderGizmoColor.b, 0.15f);
				Gizmos.DrawCube(Vector3.zero, Vector3.one);
				Gizmos.color = wanderGizmoColor;
				Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
			}
		}
		Gizmos.matrix = matrix2;
	}
}
[Serializable]
public class ModmasCivvie
{
	[HideInInspector]
	public Sosig mySos;

	[HideInInspector]
	public List<Vector3> pathPositions;

	[HideInInspector]
	public List<Vector3> pathRotations;

	[HideInInspector]
	public float respawntimestamp = -1f;

	public SosigSpeechSet speechSetOverride;

	public int id;
}
public class ModmasHintBoard : MonoBehaviour
{
	public GameObject[] giftHintObjects;

	private bool[] isgiftfound;

	private ExtensibleDictionary myDic;

	[SerializeField]
	private string mod_folder_name = string.Empty;

	private string save_file_name = "hintboard_save.json";

	private void Start()
	{
		isgiftfound = new bool[giftHintObjects.Length];
		InitializeSaveFile();
		ReadVarsFromSaveFile();
		RefreshHints();
	}

	public void MakeGiftFound(int index)
	{
		if (index < 0 || index >= isgiftfound.Length)
		{
			Debug.LogError((object)("Invalid gift hint index: " + index));
		}
		else if (!isgiftfound[index])
		{
			isgiftfound[index] = true;
			RefreshHints();
			RefreshSaveFile();
		}
	}

	private void InitializeSaveFile()
	{
		string text = FileIO.ReadFile(mod_folder_name, save_file_name);
		if (text == null)
		{
			text = CreateDefaultSaveFile();
			FileIO.WriteToFile(mod_folder_name, save_file_name, text);
		}
		else
		{
			myDic = ExtensibleDictionary.FromJson(text);
		}
	}

	private string CreateDefaultSaveFile()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		myDic = new ExtensibleDictionary();
		for (int i = 0; i < giftHintObjects.Length; i++)
		{
			myDic.AddEntry(i.ToString(), false.ToString());
		}
		return myDic.ToJson();
	}

	private void ReadVarsFromSaveFile()
	{
		for (int i = 0; i < giftHintObjects.Length; i++)
		{
			isgiftfound[i] = bool.Parse(myDic.GetValue(i.ToString()));
		}
	}

	private void WriteVarsToMyDic()
	{
		if (myDic == null)
		{
			Debug.LogError((object)"DICTIONARY MISSING IN HINT BOARD!!!");
			return;
		}
		for (int i = 0; i < giftHintObjects.Length; i++)
		{
			myDic.InsertOrUpdateEntry(i.ToString(), isgiftfound[i].ToString());
		}
	}

	private void RefreshSaveFile()
	{
		WriteVarsToMyDic();
		FileIO.WriteToFile(mod_folder_name, save_file_name, myDic.ToJson());
		myDic = ExtensibleDictionary.FromJson(FileIO.ReadFile(mod_folder_name, save_file_name));
		ReadVarsFromSaveFile();
	}

	private void RefreshHints()
	{
		for (int i = 0; i < giftHintObjects.Length; i++)
		{
			giftHintObjects[i].gameObject.SetActive(isgiftfound[i]);
		}
	}

	private void OnValidate()
	{
		if (giftHintObjects != null && (isgiftfound == null || isgiftfound.Length != giftHintObjects.Length))
		{
			Array.Resize(ref isgiftfound, giftHintObjects.Length);
		}
	}
}
namespace nrgill28.AtlasSampleScene
{
	public class CTF_CaptureZone : MonoBehaviour
	{
		public CTF_Manager Manager;

		public CTF_Team Team;

		public void OnTriggerEnter(Collider other)
		{
			CTF_Flag component = ((Component)other).GetComponent<CTF_Flag>();
			if (Object.op_Implicit((Object)(object)component) && component.Team != Team)
			{
				Manager.FlagCaptured(component);
			}
		}
	}
	public class CTF_Flag : FVRPhysicalObject
	{
		[Header("Flag stuffs")]
		public CTF_Team Team;

		public float RespawnDelay = 10f;

		public Vector3 FloorOffset = new Vector3(0f, 0.25f, 0f);

		private Vector3 _resetPosition;

		private Quaternion _resetRotation;

		private Transform _followTransform;

		private bool _isHeld;

		private bool _isTaken;

		private float _timer;

		private CTF_Sosig _heldBy;

		public override void Awake()
		{
			//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_001f: 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)
			((FVRPhysicalObject)this).Awake();
			_resetPosition = ((Component)this).transform.position;
			_resetRotation = ((Component)this).transform.rotation;
		}

		private void Update()
		{
			if (_isTaken && !_isHeld)
			{
				_timer -= Time.deltaTime;
				if (_timer < 0f)
				{
					ReturnFlag();
				}
			}
		}

		public void Take()
		{
			_isHeld = true;
			_isTaken = true;
		}

		public void Drop()
		{
			//IL_001a: 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_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_0050: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).IsHeld = false;
			_timer = RespawnDelay;
			NavMeshHit val = default(NavMeshHit);
			NavMesh.SamplePosition(((Component)this).transform.position, ref val, 100f, -1);
			((Component)this).transform.position = ((NavMeshHit)(ref val)).position + FloorOffset;
			((Component)this).transform.rotation = Quaternion.identity;
		}

		public void ReturnFlag()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (((FVRInteractiveObject)this).IsHeld)
			{
				((FVRInteractiveObject)this).ForceBreakInteraction();
			}
			if (Object.op_Implicit((Object)(object)_heldBy))
			{
				_heldBy.HeldFlag = null;
			}
			((Component)this).transform.SetPositionAndRotation(_resetPosition, _resetRotation);
			_isTaken = false;
		}

		private void OnTriggerEnter(Collider other)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (_isHeld)
			{
				return;
			}
			CTF_Sosig componentInParent = ((Component)other).GetComponentInParent<CTF_Sosig>();
			if (Object.op_Implicit((Object)(object)componentInParent) && (int)componentInParent.Sosig.BodyState == 0)
			{
				if (componentInParent.Team == Team)
				{
					ReturnFlag();
					return;
				}
				_heldBy = componentInParent;
				componentInParent.HeldFlag = this;
				Take();
			}
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).BeginInteraction(hand);
			Take();
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).EndInteraction(hand);
			Drop();
		}
	}
	public class CTF_Manager : MonoBehaviour
	{
		[Header("References")]
		public Text[] ScoreTexts;

		public Transform[] AttackPoints;

		public Text StartButtonText;

		[Header("Red Team")]
		public CTF_Flag RedFlag;

		public int RedTeamSize;

		public Transform[] RedSpawns;

		public SosigEnemyID[] RedTeam;

		[Header("Blue Team")]
		public CTF_Flag BlueFlag;

		public int BlueTeamSize;

		public Transform[] BlueSpawns;

		public SosigEnemyID[] BlueTeam;

		private int _blueScore;

		private int _redScore;

		private bool _running;

		private readonly List<CTF_Sosig> _sosigs = new List<CTF_Sosig>();

		private readonly SpawnOptions _spawnOptions;

		public CTF_Manager()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SpawnOptions val = new SpawnOptions();
			val.SpawnState = (SosigOrder)7;
			val.SpawnActivated = true;
			val.EquipmentMode = (EquipmentSlots)7;
			val.SpawnWithFullAmmo = true;
			_spawnOptions = val;
			((MonoBehaviour)this)..ctor();
		}

		private void Start()
		{
			UpdateScoreText();
		}

		public void ToggleGame()
		{
			if (_running)
			{
				EndGame();
				StartButtonText.text = "Start Game";
			}
			else
			{
				StartGame();
				StartButtonText.text = "Stop Game";
			}
		}

		private void StartGame()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			ResetGame();
			_running = true;
			GM.CurrentSceneSettings.SosigKillEvent += new SosigKill(CurrentSceneSettingsOnSosigKillEvent);
			((MonoBehaviour)this).StartCoroutine(DoInitialSpawns());
		}

		private void EndGame()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			GM.CurrentSceneSettings.SosigKillEvent -= new SosigKill(CurrentSceneSettingsOnSosigKillEvent);
			foreach (CTF_Sosig sosig in _sosigs)
			{
				sosig.Sosig.ClearSosig();
			}
			_running = false;
		}

		private void CurrentSceneSettingsOnSosigKillEvent(Sosig s)
		{
			CTF_Sosig cTF_Sosig = _sosigs.FirstOrDefault((CTF_Sosig x) => (Object)(object)x.Sosig == (Object)(object)s);
			if (Object.op_Implicit((Object)(object)cTF_Sosig))
			{
				((MonoBehaviour)this).StartCoroutine(RespawnSosig(cTF_Sosig));
			}
		}

		private void SpawnSosig(CTF_Team team)
		{
			//IL_001e: 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_006f: 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_007b: 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)
			_spawnOptions.IFF = (int)team;
			_spawnOptions.SosigTargetPosition = SodaliteUtils.GetRandom<Transform>((IList<Transform>)AttackPoints).position;
			Transform transform;
			SosigEnemyID random;
			if (team == CTF_Team.Red)
			{
				transform = ((Component)SodaliteUtils.GetRandom<Transform>((IList<Transform>)RedSpawns)).transform;
				random = SodaliteUtils.GetRandom<SosigEnemyID>((IList<SosigEnemyID>)RedTeam);
			}
			else
			{
				transform = ((Component)SodaliteUtils.GetRandom<Transform>((IList<Transform>)BlueSpawns)).transform;
				random = SodaliteUtils.GetRandom<SosigEnemyID>((IList<SosigEnemyID>)BlueTeam);
			}
			Sosig val = SosigAPI.Spawn(ManagerSingleton<IM>.Instance.odicSosigObjsByID[random], _spawnOptions, transform.position, transform.rotation);
			CTF_Sosig cTF_Sosig = ((Component)val).gameObject.AddComponent<CTF_Sosig>();
			_sosigs.Add(cTF_Sosig);
			cTF_Sosig.Sosig = val;
			cTF_Sosig.Team = team;
		}

		private IEnumerator DoInitialSpawns()
		{
			int i = 0;
			while (i < Mathf.Max(RedTeamSize, BlueTeamSize))
			{
				if (i < RedTeamSize)
				{
					SpawnSosig(CTF_Team.Red);
				}
				if (i < BlueTeamSize)
				{
					SpawnSosig(CTF_Team.Blue);
				}
				i++;
				yield return (object)new WaitForSeconds(2.5f);
			}
		}

		private IEnumerator RespawnSosig(CTF_Sosig sosig)
		{
			yield return (object)new WaitForSeconds(5f);
			sosig.Sosig.ClearSosig();
			_sosigs.Remove(sosig);
			yield return (object)new WaitForSeconds(5f);
			if (_running)
			{
				int sosigsLeft = _sosigs.Count((CTF_Sosig x) => x.Team == sosig.Team);
				int teamSize = ((sosig.Team != CTF_Team.Red) ? BlueTeamSize : RedTeamSize);
				if (sosigsLeft < teamSize)
				{
					SpawnSosig(sosig.Team);
				}
			}
		}

		public void ResetGame()
		{
			_blueScore = 0;
			_redScore = 0;
			UpdateScoreText();
			if (Object.op_Implicit((Object)(object)RedFlag))
			{
				RedFlag.ReturnFlag();
			}
			if (Object.op_Implicit((Object)(object)BlueFlag))
			{
				BlueFlag.ReturnFlag();
			}
		}

		public void FlagCaptured(CTF_Flag flag)
		{
			if (flag.Team == CTF_Team.Red)
			{
				_blueScore++;
			}
			else
			{
				_redScore++;
			}
			UpdateScoreText();
			flag.ReturnFlag();
		}

		public void UpdateScoreText()
		{
			Text[] scoreTexts = ScoreTexts;
			foreach (Text val in scoreTexts)
			{
				val.text = "<color=red>" + _redScore + "</color> - <color=blue>" + _blueScore + "</color>";
			}
		}

		private void OnDrawGizmos()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_007d: 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)
			Gizmos.color = Color.red;
			Transform[] redSpawns = RedSpawns;
			foreach (Transform val in redSpawns)
			{
				Gizmos.DrawSphere(val.position, 0.15f);
			}
			Gizmos.color = Color.blue;
			Transform[] blueSpawns = BlueSpawns;
			foreach (Transform val2 in blueSpawns)
			{
				Gizmos.DrawSphere(val2.position, 0.15f);
			}
			Gizmos.color = Color.green;
			Transform[] attackPoints = AttackPoints;
			foreach (Transform val3 in attackPoints)
			{
				Gizmos.DrawSphere(val3.position, 0.15f);
			}
		}
	}
	public class CTF_Sosig : MonoBehaviour
	{
		public CTF_Team Team;

		public CTF_Flag HeldFlag;

		public Sosig Sosig;

		private void Awake()
		{
			Sosig = ((Component)this).GetComponent<Sosig>();
		}

		private void Update()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0059: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)HeldFlag))
			{
				Vector3 val = ((Component)Sosig).transform.position - ((Component)Sosig).transform.forward * 0.1f;
				((Component)HeldFlag).transform.SetPositionAndRotation(val, ((Component)Sosig).transform.rotation);
			}
		}
	}
	public enum CTF_Team
	{
		Red,
		Blue
	}
	public class PopupTarget : MonoBehaviour, IFVRDamageable
	{
		[Flags]
		public enum TargetRange
		{
			Near = 1,
			Mid = 2,
			Far = 4,
			All = 7
		}

		public PopupTargetManager Manager;

		public TargetRange Range;

		public Transform Pivot;

		public Vector3 SetRotation;

		private Quaternion _startRotation;

		private Quaternion _endRotation;

		private bool _set;

		public bool Set
		{
			get
			{
				return _set;
			}
			set
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: 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)
				if (_set != value)
				{
					_set = value;
					((MonoBehaviour)this).StartCoroutine((!_set) ? RotateTo(_endRotation, _startRotation) : RotateTo(_startRotation, _endRotation));
				}
			}
		}

		private void Awake()
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_002e: Unknown result type (might be due to invalid IL or missing references)
			_startRotation = Pivot.rotation;
			_endRotation = Quaternion.Euler(SetRotation + ((Quaternion)(ref _startRotation)).eulerAngles);
		}

		void IFVRDamageable.Damage(Damage dam)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			if (Set && (int)dam.Class == 1)
			{
				Set = false;
				Manager.TargetHit(this);
			}
		}

		private IEnumerator RotateTo(Quaternion from, Quaternion to)
		{
			//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_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)
			float elapsed = 0f;
			while (elapsed < 0.25f)
			{
				yield return null;
				elapsed += Time.deltaTime;
				Pivot.localRotation = Quaternion.Slerp(from, to, elapsed / 0.25f);
			}
			Pivot.rotation = to;
		}
	}
	public class PopupTargetManager : MonoBehaviour
	{
		public List<PopupTarget> Targets;

		private readonly List<PopupTarget> _setTargets = new List<PopupTarget>();

		private void Awake()
		{
			((MonoBehaviour)this).StartCoroutine(StartSetAsync(3f, 8f, 5, PopupTarget.TargetRange.All));
		}

		private IEnumerator StartSetAsync(float minDelay, float maxDelay, int numTargets, PopupTarget.TargetRange ranges)
		{
			yield return (object)new WaitForSeconds(Random.Range(minDelay, maxDelay));
			IListExtensions.Shuffle<PopupTarget>((IList<PopupTarget>)Targets);
			_setTargets.Clear();
			foreach (PopupTarget target in Targets)
			{
				if ((target.Range & ranges) != 0)
				{
					target.Set = true;
					_setTargets.Add(target);
					numTargets--;
				}
				if (numTargets == 0)
				{
					break;
				}
			}
		}

		public void TargetHit(PopupTarget target)
		{
			if (_setTargets.Contains(target))
			{
				_setTargets.Remove(target);
				if (_setTargets.Count == 0)
				{
					((MonoBehaviour)this).StartCoroutine(StartSetAsync(3f, 8f, 5, PopupTarget.TargetRange.All));
				}
			}
		}
	}
}