using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using FalseGods.Core.Arena; using FalseGods.Core.Bosses; using FalseGods.Core.Simulation; using FalseGods.RuntimeContracts.Arena; using FalseGods.RuntimeContracts.Diagnostics; using FalseGods.RuntimeContracts.Presentation; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("FalseGods.UnityRuntime")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6e5740a80f810ab422551028733810b527fb614d")] [assembly: AssemblyProduct("FalseGods.UnityRuntime")] [assembly: AssemblyTitle("FalseGods.UnityRuntime")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FalseGods.UnityRuntime.Presentation { public enum BossFacingMode { Fixed, LocalBillboard, NearestPlayer } public sealed class BossPresentation : IEncounterPresentation, IDisposable { private enum TransientKind { Fly, Fade } private sealed class Transient { public GameObject Object { get; } public Vector3 From { get; } public Vector3 To { get; } public float Seconds { get; } public TransientKind Kind { get; } public Material Material { get; } public float Elapsed { get; set; } public Transient(GameObject obj, Vector3 from, Vector3 to, float seconds, TransientKind kind, Material material = null) { //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Object = obj; From = from; To = to; Seconds = seconds; Kind = kind; Material = material; } } private const float BodyHeight = 2.4f; private const float BodyWidth = 1.6f; private const float MuzzleForward = 0.9f; private const float DefaultSpriteScale = 2f; private const float SinkDepth = 3.2f; private const float SinkSeconds = 0.42f; private const float RiseSeconds = 0.33f; private const float LurchDegrees = 23f; private const float SettleSeconds = 1.6f; private const float SettleFrequency = 3.2f; private const string BodyTextureResourceSuffix = "boss-body.png"; private static readonly Color PhaseOneColor = new Color(0.2f, 0.7f, 0.65f); private static readonly Color PhaseTwoColor = new Color(0.85f, 0.35f, 0.18f); private static readonly Color DeadColor = new Color(0.2f, 0.2f, 0.22f); private static readonly Color TelegraphProjectileColor = new Color(0.95f, 0.25f, 0.2f); private static readonly Color TelegraphAreaColor = new Color(0.95f, 0.55f, 0.1f); private static readonly Color RageTint = new Color(1f, 0.28f, 0.22f); private const float RoarSeconds = 1.9f; private const float RoarRiseFraction = 0.18f; private const float RoarHoldFraction = 0.34f; private const float RoarRearUp = 0.45f; private const float RoarSquashRatio = 0.55f; private const float RoarShakeDegrees = 7f; private const float RoarShakeFrequency = 9f; private const float HitFlashSeconds = 0.12f; private const float HitFlashBrightness = 2.6f; private const float HitFlinchSeconds = 0.16f; private const float HitFlinchSquash = 0.09f; private const float HitFlinchDegrees = 4f; private const float DeathSinkSeconds = 2.4f; private const float DeathRockDegrees = 14f; private const float DeathRockFrequency = 1.1f; private const float DeathSinkClearance = 1.5f; private readonly ILogger _logger; private readonly float _floorY; private readonly Shader _shader; private readonly string _shaderName; private readonly Vector3 _fixedForward; private readonly GameObject _root; private readonly GameObject _collisionBody; private readonly GameObject _hitBody; private readonly Transform _bodyBillboard; private readonly Transform _aimPivot; private readonly Transform _body; private readonly Material _bodyMat; private readonly Transform _muzzle; private readonly Texture2D _bodyTexture; private readonly bool _bodyTextured; private GameObject _telegraph; private Material _telegraphMat; private readonly List _transients = new List(); private float _time; private PresentationState _state; private bool _hasState; private float _flashTimer; private float _flinchTimer; private float _deathElapsed; private bool _flashWeakPoint; private float _phasePulseTimer; private float _appearPulseTimer; private float _roarTimer; private bool _reportedFog; private bool _dead; private bool _telegraphActive; private AttackVisualKind _telegraphKind; private Vector3 _telegraphAim; private float _telegraphStart; private float _telegraphSeconds; private BossVisualActivity _lastActivity; private float _activityStart; private float _relocationTilt; public BossFacingMode FacingMode { get; set; } = BossFacingMode.LocalBillboard; public bool LockPitch { get; set; } public float SpriteScale { get; set; } = 2f; public Collider BodyCollider { get; } public Collider CollisionCollider { get; } public Collider HitCollider { get; } public BossPresentation(ILogger logger, Vector3 origin, float arenaFloorY) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_007c: 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_00a3: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_016b: 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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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_0221: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Expected O, but got Unknown //IL_0372: Unknown result type (might be due to invalid IL or missing references) _logger = logger; _floorY = arenaFloorY; _shader = ResolveShader(logger, out _shaderName); _bodyTexture = LoadEmbeddedBodyTexture(logger); _bodyTextured = (Object)(object)_bodyTexture != (Object)null; _root = new GameObject("FalseGodsBoss"); _root.transform.position = origin; _fixedForward = ComputeSpawnFacing(_root.transform.position); _bodyBillboard = new GameObject("BodyBillboard").transform; _bodyBillboard.SetParent(_root.transform, false); _bodyBillboard.localPosition = new Vector3(0f, 1.2f, 0f); _aimPivot = new GameObject("AimPivot").transform; _aimPivot.SetParent(_root.transform, false); GameObject val = CreateQuad("Body", _bodyBillboard, _bodyTextured ? Color.white : PhaseOneColor, out _bodyMat); if (_bodyTextured) { _bodyMat.mainTexture = (Texture)(object)_bodyTexture; } _body = val.transform; _body.localPosition = Vector3.zero; float num = (_bodyTextured ? (2.4f * ((float)((Texture)_bodyTexture).width / (float)((Texture)_bodyTexture).height)) : 1.6f); _body.localScale = new Vector3(num, 2.4f, 1f); BodyCollider = AddBox(val); _muzzle = new GameObject("Muzzle").transform; _muzzle.SetParent(_aimPivot, false); _muzzle.localPosition = new Vector3(0f, 1.2f, 0.9f); _collisionBody = new GameObject("CollisionBody"); _collisionBody.transform.SetParent(_root.transform, false); int num2 = LayerMask.NameToLayer("Entities"); if (num2 >= 0) { _collisionBody.layer = num2; } else { ILogger logger2 = _logger; if (logger2 != null) { logger2.LogWarning("'Entities' layer not found; boss collision left on the Default layer."); } } CapsuleCollider val2 = _collisionBody.AddComponent(); val2.direction = 1; val2.height = 2.4f; val2.radius = 0.71999997f; val2.center = new Vector3(0f, 1.2f, 0f); CollisionCollider = (Collider)(object)val2; Rigidbody obj = _collisionBody.AddComponent(); obj.isKinematic = true; obj.useGravity = false; _hitBody = new GameObject("WeaponHitBody"); _hitBody.transform.SetParent(_root.transform, false); int num3 = LayerMask.NameToLayer("Hitbox"); if (num3 >= 0) { _hitBody.layer = num3; } else { ILogger logger3 = _logger; if (logger3 != null) { logger3.LogWarning("'Hitbox' layer not found; weapon hits left on the Default layer."); } } CapsuleCollider val3 = _hitBody.AddComponent(); val3.direction = 1; val3.height = 2.4f; val3.radius = 0.71999997f; val3.center = new Vector3(0f, 1.2f, 0f); ((Collider)val3).isTrigger = true; HitCollider = (Collider)(object)val3; ILogger logger4 = _logger; if (logger4 != null) { logger4.Log($"boss renderer shader: {_shaderName} (supported={(Object)(object)_shader != (Object)null && _shader.isSupported})"); } ILogger logger5 = _logger; if (logger5 != null) { logger5.Log($"boss renderer floor y: {_floorY}"); } ILogger logger6 = _logger; if (logger6 != null) { logger6.Log($"boss collision: capsule h={2.4f} r={0.71999997f:0.00} on layer " + "'" + ((num2 >= 0) ? "Entities" : "Default") + "' (kinematic Rigidbody); weapon-hit capsule on '" + ((num3 >= 0) ? "Hitbox" : "Default") + "' (trigger)"); } } public void Apply(PresentationState state) { _state = state; _hasState = true; } public void Handle(IPresentationEvent presentationEvent) { //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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_0193: 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_01b1: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) if (!(presentationEvent is BossAppeared)) { AttackTelegraphStarted val = (AttackTelegraphStarted)(object)((presentationEvent is AttackTelegraphStarted) ? presentationEvent : null); SimVector2 val8; AttackInstanceId attack; if (val == null) { AttackLanded val2 = (AttackLanded)(object)((presentationEvent is AttackLanded) ? presentationEvent : null); if (val2 == null) { WeakPointVisibilityChanged val3 = (WeakPointVisibilityChanged)(object)((presentationEvent is WeakPointVisibilityChanged) ? presentationEvent : null); if (val3 == null) { PhaseTransition val4 = (PhaseTransition)(object)((presentationEvent is PhaseTransition) ? presentationEvent : null); if (val4 == null) { BossHit val5 = (BossHit)(object)((presentationEvent is BossHit) ? presentationEvent : null); if (val5 == null) { BossMoved val6 = (BossMoved)(object)((presentationEvent is BossMoved) ? presentationEvent : null); if (val6 == null) { if (!(presentationEvent is BossRoared)) { RageChanged val7 = (RageChanged)(object)((presentationEvent is RageChanged) ? presentationEvent : null); if (val7 == null) { if (presentationEvent is BossDefeated) { _dead = true; _deathElapsed = 0f; _telegraphActive = false; HideTelegraph(); ILogger logger = _logger; if (logger != null) { logger.Log("[cue] BossDefeated"); } } } else { if (val7.Enraged) { _roarTimer = 1.9f; } ILogger logger2 = _logger; if (logger2 != null) { logger2.Log("[cue] RageChanged enraged=" + val7.Enraged); } } } else { _roarTimer = 1.9f; ILogger logger3 = _logger; if (logger3 != null) { logger3.Log("[cue] BossRoared"); } } } else { ILogger logger4 = _logger; if (logger4 != null) { val8 = val6.Position; object arg = ((SimVector2)(ref val8)).X; object arg2 = val6.PositionHeight; val8 = val6.Position; logger4.Log($"[cue] BossMoved to ({arg:0.0}, {arg2:0.0}, {((SimVector2)(ref val8)).Z:0.0})"); } } } else { _flashTimer = 0.12f; _flinchTimer = 0.16f; _flashWeakPoint = val5.WeakPointHit; } } else { _phasePulseTimer = 0.5f; ILogger logger5 = _logger; if (logger5 != null) { logger5.Log($"[cue] PhaseTransition -> phaseVisual={val4.PhaseVisualId}"); } } } else if (val3.Exposed) { _flashTimer = 0.15f; _flashWeakPoint = true; } } else { _telegraphActive = false; HideTelegraph(); AttackVisualKind kind = val2.Kind; val8 = val2.AimPoint; float x = ((SimVector2)(ref val8)).X; float floorY = _floorY; val8 = val2.AimPoint; SpawnImpact(kind, new Vector3(x, floorY, ((SimVector2)(ref val8)).Z)); ILogger logger6 = _logger; if (logger6 != null) { object arg3 = val2.Kind; attack = val2.Attack; logger6.Log($"[cue] AttackLanded {arg3} attack={((AttackInstanceId)(ref attack)).Value}"); } } } else { _telegraphActive = true; _telegraphKind = val.Kind; val8 = val.AimPoint; float x2 = ((SimVector2)(ref val8)).X; float floorY2 = _floorY; val8 = val.AimPoint; _telegraphAim = new Vector3(x2, floorY2, ((SimVector2)(ref val8)).Z); _telegraphStart = _time; _telegraphSeconds = Mathf.Max(0.05f, val.TelegraphSeconds); ILogger logger7 = _logger; if (logger7 != null) { object[] obj = new object[4] { val.Kind, null, null, null }; attack = val.Attack; obj[1] = ((AttackInstanceId)(ref attack)).Value; val8 = val.AimPoint; obj[2] = ((SimVector2)(ref val8)).X; val8 = val.AimPoint; obj[3] = ((SimVector2)(ref val8)).Z; logger7.Log(string.Format("[cue] AttackTelegraphStarted {0} attack={1} aim=({2:0.0},{3:0.0})", obj)); } } } else { _appearPulseTimer = 0.4f; ILogger logger8 = _logger; if (logger8 != null) { logger8.Log("[cue] BossAppeared"); } } } public void Render(float deltaSeconds) { //IL_0046: 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_0067: 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: Invalid comparison between Unknown and I4 //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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Invalid comparison between Unknown and I4 //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Invalid comparison between Unknown and I4 //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) if (deltaSeconds > 0f) { _time += deltaSeconds; } Camera main = Camera.main; if (SpriteScale > 0f) { _root.transform.localScale = new Vector3(SpriteScale, SpriteScale, SpriteScale); } if (_hasState) { if (_state.Activity != _lastActivity) { _lastActivity = _state.Activity; _activityStart = _time; if ((int)_state.Activity != 1 && (int)_state.Activity != 2) { _telegraphActive = false; } } RelocationOffset(out var sink, out var tilt); bool flag = (int)_state.Activity != 6 && !IsBuried(); if (_collisionBody.activeSelf != flag) { _collisionBody.SetActive(flag); _hitBody.SetActive(flag); } Transform transform = _root.transform; SimVector2 val = _state.Position; float x = ((SimVector2)(ref val)).X; float num = _state.PositionHeight + sink; val = _state.Position; transform.position = new Vector3(x, num, ((SimVector2)(ref val)).Z); _relocationTilt = tilt; val = _state.Facing; if (!(Math.Abs(((SimVector2)(ref val)).X) > 0.0001f)) { val = _state.Facing; if (!(Math.Abs(((SimVector2)(ref val)).Z) > 0.0001f)) { goto IL_01d1; } } Transform aimPivot = _aimPivot; val = _state.Facing; float x2 = ((SimVector2)(ref val)).X; val = _state.Facing; aimPivot.rotation = Quaternion.LookRotation(new Vector3(x2, 0f, ((SimVector2)(ref val)).Z), Vector3.up); goto IL_01d1; } goto IL_01d7; IL_01d7: OrientBody(main); AnimateTelegraph(); AnimateTransients(deltaSeconds); if (_flashTimer > 0f) { _flashTimer -= deltaSeconds; if (_flashTimer <= 0f) { UpdateBodyColor(); } } if (_phasePulseTimer > 0f) { _phasePulseTimer -= deltaSeconds; } if (_appearPulseTimer > 0f) { _appearPulseTimer -= deltaSeconds; } if (_roarTimer > 0f) { _roarTimer -= deltaSeconds; } if (_flinchTimer > 0f) { _flinchTimer -= deltaSeconds; } if (_dead) { _deathElapsed += deltaSeconds; _bodyBillboard.localScale = Vector3.one; } else { float num2 = 1f + ((_phasePulseTimer > 0f) ? (_phasePulseTimer * 0.5f) : 0f) + ((_appearPulseTimer > 0f) ? (_appearPulseTimer * 0.4f) : 0f); float num3 = RoarRise() * 0.45f - FlinchDrop() * 0.09f; _bodyBillboard.localScale = new Vector3(num2 * (1f - num3 * 0.55f), num2 * (1f + num3), num2); } return; IL_01d1: UpdateBodyColor(); goto IL_01d7; } private void OrientBody(Camera camera) { //IL_0020: 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_005a: 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_00bb: 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_00d0: Unknown result type (might be due to invalid IL or missing references) OrientBodyFacing(camera); if (Math.Abs(_relocationTilt) > 0.01f) { Transform bodyBillboard = _bodyBillboard; bodyBillboard.rotation *= Quaternion.Euler(0f, 0f, _relocationTilt); } float num = FlinchDrop(); if (num > 0.001f) { Transform bodyBillboard2 = _bodyBillboard; bodyBillboard2.rotation *= Quaternion.Euler(0f, 0f, 4f * num); } float num2 = RoarRise(); if (num2 > 0.001f) { float num3 = Mathf.Sin(_time * 9f * (float)Math.PI * 2f) * 7f * num2; Transform bodyBillboard3 = _bodyBillboard; bodyBillboard3.rotation *= Quaternion.Euler(0f, 0f, num3); } } private void OrientBodyFacing(Camera camera) { //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_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_00cd: 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_00e3: 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_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_007a: 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_007f: 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_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_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) switch (FacingMode) { case BossFacingMode.Fixed: _bodyBillboard.rotation = Quaternion.LookRotation(-_fixedForward, Vector3.up); break; case BossFacingMode.NearestPlayer: { ? val; if (!_hasState) { val = _fixedForward; } else { SimVector2 facing = _state.Facing; float x = ((SimVector2)(ref facing)).X; facing = _state.Facing; val = new Vector3(x, 0f, ((SimVector2)(ref facing)).Z); } Vector3 val2 = (Vector3)val; if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f) { val2 = _fixedForward; } _bodyBillboard.rotation = Quaternion.LookRotation(-((Vector3)(ref val2)).normalized, Vector3.up); break; } default: if ((Object)(object)camera != (Object)null) { _bodyBillboard.rotation = FaceCameraRotation(_bodyBillboard.position, ((Component)camera).transform.position, LockPitch); } break; } } private void RelocationOffset(out float sink, out float tilt) { //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_0035: 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_0049: Expected I4, but got Unknown if (_dead) { DeathOffset(out sink, out tilt); return; } float num = Math.Max(0f, _time - _activityStart); BossVisualActivity activity = _state.Activity; switch (activity - 5) { case 0: { float num4 = Mathf.Clamp01(num / 0.42f); sink = -3.2f * num4 * num4; tilt = 23f * Mathf.Sin(num4 * (float)Math.PI * 2f); break; } case 1: sink = -3.2f; tilt = 0f; break; case 2: { float num2 = Mathf.Clamp01(num / 0.33f); sink = -3.2f * (1f - num2) * (1f - num2); float num3 = Mathf.Clamp01(1f - num / 1.6f); tilt = 23f * num3 * num3 * Mathf.Sin(num * 3.2f * (float)Math.PI * 2f); break; } default: sink = 0f; tilt = 0f; break; } } private void DeathOffset(out float sink, out float tilt) { float num = Mathf.Clamp01(_deathElapsed / 2.4f); sink = (0f - DeathDepth()) * num * num; tilt = 14f * (1f - num * 0.4f) * Mathf.Sin(_deathElapsed * 1.1f * (float)Math.PI * 2f); } private float DeathDepth() { return 2.4f * ((SpriteScale > 0f) ? SpriteScale : 2f) + 1.5f; } private bool IsBuried() { if (_dead) { return _deathElapsed >= 1.2f; } return false; } private float FlinchDrop() { if (_flinchTimer <= 0f) { return 0f; } float num = Mathf.Clamp01(_flinchTimer / 0.16f); return num * num; } private Quaternion FaceCameraRotation(Vector3 spritePos, Vector3 cameraPos, bool lockPitch) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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_002c: 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_001c: 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_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_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_0088: 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_0093: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) Vector3 val = cameraPos - spritePos; if (((Vector3)(ref val)).sqrMagnitude < 1E-06f) { return _bodyBillboard.rotation; } Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(normalized.x, 0f, normalized.z); if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f) { val2 = _bodyBillboard.forward; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f) { val2 = _fixedForward; } } val2 = ((Vector3)(ref val2)).normalized; if (lockPitch) { return Quaternion.LookRotation(-val2, Vector3.up); } Vector3 val3 = ((Mathf.Abs(Vector3.Dot(Vector3.up, normalized)) > 0.999f) ? Vector3.forward : Vector3.up); return Quaternion.LookRotation(-normalized, val3); } private float RoarRise() { if (_roarTimer <= 0f) { return 0f; } float num = Mathf.Clamp01(1f - _roarTimer / 1.9f); if (num < 0.18f) { return Mathf.SmoothStep(0f, 1f, num / 0.18f); } float num2 = 0.52f; if (num < num2) { return 1f; } return Mathf.SmoothStep(1f, 0f, (num - num2) / Mathf.Max(0.0001f, 1f - num2)); } private Color Fogged(Color color) { //IL_0028: 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_004b: 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_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_00bb: 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_006d: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; float fogStartDistance = RenderSettings.fogStartDistance; float fogEndDistance = RenderSettings.fogEndDistance; float num = (((Object)(object)main != (Object)null) ? Vector3.Distance(((Component)main).transform.position, _bodyBillboard.position) : 0f); if ((Object)(object)main == (Object)null || fogEndDistance <= fogStartDistance) { return color; } if (!_reportedFog) { _reportedFog = true; ILogger logger = _logger; if (logger != null) { logger.Log($"[boss-fog] the level fades to {RenderSettings.fogColor} between {fogStartDistance:0.#}m and " + $"{fogEndDistance:0.#}m; the boss now fades with it."); } } float num2 = Mathf.Clamp01((fogEndDistance - num) / (fogEndDistance - fogStartDistance)); Color result = Color.Lerp(RenderSettings.fogColor, color, num2); result.a = color.a; return result; } private void UpdateBodyColor() { //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_009a: 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_002e: 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_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_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_0086: 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_008d: Unknown result type (might be due to invalid IL or missing references) Color color; if (_dead) { color = DeadColor; } else { if (_flashTimer > 0f && !_flashWeakPoint) { SetColor(_bodyMat, Color.white * 2.6f); return; } color = ((_hasState && _state.Enraged) ? RageTint : ((!_bodyTextured) ? ((_hasState && _state.PhaseVisualId >= 2) ? PhaseTwoColor : PhaseOneColor) : Color.white)); } SetColor(_bodyMat, Fogged(color)); } private void AnimateTelegraph() { //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_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_0081: 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_0092: Invalid comparison between Unknown and I4 //IL_009b: 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_00a0: 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_00a8: Invalid comparison between Unknown and I4 //IL_00df: 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_0126: Unknown result type (might be due to invalid IL or missing references) if (_telegraphActive) { EnsureTelegraph(); float num = ((_telegraphSeconds > 0f) ? Mathf.Clamp01((_time - _telegraphStart) / _telegraphSeconds) : 1f); _telegraph.transform.position = _telegraphAim + Vector3.up * 0.02f; _telegraph.transform.rotation = Quaternion.Euler(90f, 0f, 0f); Color val = (((int)_telegraphKind == 1) ? TelegraphProjectileColor : TelegraphAreaColor); float num2 = (((int)_telegraphKind == 1) ? Mathf.Lerp(3f, 1f, num) : Mathf.Lerp(0.3f, 3f, num)); _telegraph.transform.localScale = new Vector3(num2, num2, 1f); float num3 = 0.5f + 0.5f * Mathf.Sin(_time * Mathf.Lerp(6f, 24f, num)); SetColor(_telegraphMat, val * (0.4f + 0.6f * num3)); } } private void SpawnImpact(AttackVisualKind kind, Vector3 aim) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_006c: 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_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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if ((int)kind == 1) { Transform val = CreateCube("Projectile", TelegraphProjectileColor); val.position = _muzzle.position; val.localScale = Vector3.one * 0.3f; _transients.Add(new Transient(((Component)val).gameObject, _muzzle.position, aim, 0.28f, TransientKind.Fly)); } else { Material material; GameObject val2 = CreateQuad("AreaBurst", null, TelegraphAreaColor, out material); val2.transform.position = aim + Vector3.up * 0.03f; val2.transform.rotation = Quaternion.Euler(90f, 0f, 0f); val2.transform.localScale = new Vector3(3f, 3f, 1f); _transients.Add(new Transient(val2, aim, aim, 0.35f, TransientKind.Fade, material)); } } private void AnimateTransients(float deltaSeconds) { //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_0083: 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) for (int num = _transients.Count - 1; num >= 0; num--) { Transient transient = _transients[num]; transient.Elapsed += deltaSeconds; float num2 = ((transient.Seconds > 0f) ? Mathf.Clamp01(transient.Elapsed / transient.Seconds) : 1f); if ((Object)(object)transient.Object != (Object)null) { if (transient.Kind == TransientKind.Fly) { transient.Object.transform.position = Vector3.Lerp(transient.From, transient.To, num2); } else if (transient.Kind == TransientKind.Fade) { transient.Object.transform.localScale = new Vector3(3f + num2 * 2f, 3f + num2 * 2f, 1f); } } if (num2 >= 1f) { if ((Object)(object)transient.Object != (Object)null) { Object.Destroy((Object)(object)transient.Object); } _transients.RemoveAt(num); } } } public void Dispose() { foreach (Transient transient in _transients) { if ((Object)(object)transient.Object != (Object)null) { Object.Destroy((Object)(object)transient.Object); } } _transients.Clear(); HideTelegraph(); if ((Object)(object)_telegraph != (Object)null) { Object.Destroy((Object)(object)_telegraph); _telegraph = null; } if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } if ((Object)(object)_bodyTexture != (Object)null) { Object.Destroy((Object)(object)_bodyTexture); } } private static Vector3 ComputeSpawnFacing(Vector3 bossPos) { //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_0021: 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_000f: 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_0041: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return Vector3.forward; } Vector3 val = ((Component)main).transform.position - bossPos; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude > 1E-06f)) { return Vector3.forward; } return ((Vector3)(ref val)).normalized; } private GameObject CreateQuad(string name, Transform parent, Color color, out Material material) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)val).name = name; StripCollider(val); if ((Object)(object)parent != (Object)null) { val.transform.SetParent(parent, false); } material = new Material(_shader); SetColor(material, color); ((Renderer)val.GetComponent()).sharedMaterial = material; return val; } private Transform CreateCube(string name, Color color) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = name; StripCollider(obj); Material val = new Material(_shader); SetColor(val, color); ((Renderer)obj.GetComponent()).sharedMaterial = val; return obj.transform; } private static Collider AddBox(GameObject go) { BoxCollider obj = go.AddComponent(); ((Collider)obj).isTrigger = true; go.layer = 2; return (Collider)(object)obj; } private static void StripCollider(GameObject go) { Collider component = go.GetComponent(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } } private void EnsureTelegraph() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_telegraph != (Object)null) { _telegraph.SetActive(true); return; } _telegraph = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_telegraph).name = "Telegraph"; StripCollider(_telegraph); _telegraphMat = new Material(_shader); SetColor(_telegraphMat, TelegraphAreaColor); ((Renderer)_telegraph.GetComponent()).sharedMaterial = _telegraphMat; } private void HideTelegraph() { if ((Object)(object)_telegraph != (Object)null) { _telegraph.SetActive(false); } } private static Texture2D LoadEmbeddedBodyTexture(ILogger logger) { //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) //IL_00cc: 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_00df: Expected O, but got Unknown try { Assembly assembly = typeof(BossPresentation).Assembly; string text = null; string[] manifestResourceNames = assembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith("boss-body.png", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (text == null) { if (logger != null) { logger.Log("boss body sprite: none embedded; using a flat coloured quad."); } return null; } byte[] array; using (Stream stream = assembly.GetManifestResourceStream(text)) { if (stream == null) { return null; } array = new byte[stream.Length]; int num; for (int j = 0; j < array.Length; j += num) { num = stream.Read(array, j, array.Length - j); if (num <= 0) { break; } } } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, name = "FalseGodsBossBody" }; if (!TryLoadImageViaGame(val, array)) { Object.Destroy((Object)(object)val); if (logger != null) { logger.LogWarning("boss body sprite '" + text + "' failed to decode; using a flat coloured quad."); } return null; } if (logger != null) { logger.Log($"boss body sprite: '{text}' loaded ({((Texture)val).width}x{((Texture)val).height})."); } return val; } catch (Exception ex) { if (logger != null) { logger.LogWarning("boss body sprite failed to load (" + ex.Message + "); using a flat coloured quad."); } return null; } } private static bool TryLoadImageViaGame(Texture2D texture, byte[] bytes) { Type type = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule"); if (type == null) { return false; } MethodInfo method = type.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }); if (method != null) { return (bool)method.Invoke(null, new object[2] { texture, bytes }); } MethodInfo method2 = type.GetMethod("LoadImage", new Type[3] { typeof(Texture2D), typeof(byte[]), typeof(bool) }); if (method2 != null) { return (bool)method2.Invoke(null, new object[3] { texture, bytes, false }); } return false; } private static Shader ResolveShader(ILogger logger, out string chosenName) { string[] array = new string[5] { "Universal Render Pipeline/Unlit", "Sprites/Default", "Unlit/Color", "Universal Render Pipeline/Lit", "Hidden/Internal-Colored" }; foreach (string text in array) { Shader val = Shader.Find(text); if ((Object)(object)val != (Object)null && val.isSupported) { chosenName = text; return val; } } if (logger != null) { logger.LogWarning("No unlit colour shader resolved; boss will render with the fallback (magenta)."); } Shader val2 = Shader.Find("Hidden/InternalErrorShader"); chosenName = (((Object)(object)val2 != (Object)null) ? ((Object)val2).name : ""); return val2; } private static void SetColor(Material material, Color color) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)material == (Object)null)) { bool num = material.HasProperty("_BaseColor"); bool flag = material.HasProperty("_Color"); if (num) { material.SetColor("_BaseColor", color); } if (flag) { material.SetColor("_Color", color); } if (!num && !flag) { material.color = color; } } } } } namespace FalseGods.UnityRuntime.Arena { public sealed class ArenaPresentation : IEncounterPresentation { private const string ExitBlockerPath = "VisualRoot/VanillaProps/ExitRoom/ExitBlocker"; private const string LightingRootName = "LightingRoot"; private static readonly Color EngagedLightColor = new Color(1f, 0.45f, 0.35f); private readonly BundleArenaRealization _realization; private readonly ILogger _logger; public ArenaPresentation(BundleArenaRealization realization, ILogger logger = null) { _realization = realization ?? throw new ArgumentNullException("realization"); _logger = logger; } public void Apply(PresentationState state) { } public void Handle(IPresentationEvent presentationEvent) { //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) GameObject currentRoot = _realization.CurrentRoot; if ((Object)(object)currentRoot == (Object)null) { return; } MechanismGroupEngaged val = (MechanismGroupEngaged)(object)((presentationEvent is MechanismGroupEngaged) ? presentationEvent : null); if (val == null) { if (presentationEvent is ExitOpened) { OpenExit(currentRoot); } return; } TintLights(currentRoot); ILogger logger = _logger; if (logger != null) { MechanismGroupId val2 = val.Group; logger.Log("[arena-cue] MechanismGroupEngaged '" + ((MechanismGroupId)(ref val2)).Value + "' — lights tinted"); } } private static void TintLights(GameObject root) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) Transform val = root.transform.Find("LightingRoot"); Light[] componentsInChildren = ((Component)(((Object)(object)val != (Object)null) ? val : root.transform)).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].color = EngagedLightColor; } } private void OpenExit(GameObject root) { Transform val = root.transform.Find("VisualRoot/VanillaProps/ExitRoom/ExitBlocker"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); ILogger logger = _logger; if (logger != null) { logger.Log("[arena-cue] ExitOpened — the rock over the doorway is gone"); } } else { ILogger logger2 = _logger; if (logger2 != null) { logger2.LogWarning("[arena-cue] ExitOpened but 'VisualRoot/VanillaProps/ExitRoom/ExitBlocker' was not found"); } } } } public sealed class BundleArenaRealization : IArenaAssetProvider, IArenaRealization { private readonly string _bundlePath; private readonly string _artifactPath; private readonly string _prefabName; private readonly ILogger _logger; private AssetBundle _bundle; private GameObject _prefab; private GameObject _root; public GameObject CurrentRoot => _root; public BundleArenaRealization(string bundlePath, string artifactPath, string prefabName, ILogger logger = null) { _bundlePath = bundlePath ?? throw new ArgumentNullException("bundlePath"); _artifactPath = artifactPath ?? throw new ArgumentNullException("artifactPath"); _prefabName = prefabName ?? throw new ArgumentNullException("prefabName"); _logger = logger; } public ArenaAssetLoadResult Load() { if ((Object)(object)_bundle != (Object)null) { throw new InvalidOperationException("Arena assets are already loaded; the flow loads once per encounter."); } if (!File.Exists(_bundlePath)) { return ArenaAssetLoadResult.Failed("arena bundle not found at " + _bundlePath); } if (!File.Exists(_artifactPath)) { return ArenaAssetLoadResult.Failed("arena content artifact not found at " + _artifactPath); } _bundle = AssetBundle.LoadFromFile(_bundlePath); if ((Object)(object)_bundle == (Object)null) { return ArenaAssetLoadResult.Failed("arena bundle failed to load from " + _bundlePath); } _prefab = _bundle.LoadAsset(_prefabName); if ((Object)(object)_prefab == (Object)null) { return ArenaAssetLoadResult.Failed("prefab '" + _prefabName + "' not found in the arena bundle"); } string text; try { text = File.ReadAllText(_artifactPath); } catch (Exception ex) { return ArenaAssetLoadResult.Failed("arena artifact unreadable: " + ex.Message); } ILogger logger = _logger; if (logger != null) { logger.Log("[arena-assets] bundle + artifact loaded (" + _prefabName + ")"); } return ArenaAssetLoadResult.Loaded(text); } public void Release() { if ((Object)(object)_root != (Object)null) { Teardown(); } if ((Object)(object)_bundle != (Object)null) { _bundle.Unload(true); _bundle = null; _prefab = null; ILogger logger = _logger; if (logger != null) { logger.Log("[arena-assets] bundle released"); } } } public ArenaRealizationResult Realize(ArenaWorldPoint origin, IReadOnlyList parityPaths, IReadOnlyList markerPaths, IReadOnlyList markerGroupPaths) { //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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00e5: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //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) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_0181: Expected O, but got Unknown //IL_01f0: 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) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Expected O, but got Unknown if ((Object)(object)_prefab == (Object)null) { return ArenaRealizationResult.Failed("arena assets are not loaded"); } if ((Object)(object)_root != (Object)null) { return ArenaRealizationResult.Failed("the arena is already realized"); } _root = Object.Instantiate(_prefab, new Vector3(((ArenaWorldPoint)(ref origin)).X, ((ArenaWorldPoint)(ref origin)).Y, ((ArenaWorldPoint)(ref origin)).Z), Quaternion.identity); ((Object)_root).name = "FalseGodsArena"; List list = new List(parityPaths.Count); foreach (string parityPath in parityPaths) { Transform val = _root.transform.Find(parityPath); if (!((Object)(object)val == (Object)null)) { list.Add(new RealizedParityNode(parityPath, ToPoint(val.localPosition), new ArenaRotation(val.localRotation.x, val.localRotation.y, val.localRotation.z, val.localRotation.w), ToPoint(val.localScale))); } } List list2 = new List(markerPaths.Count); foreach (string markerPath in markerPaths) { Transform val2 = _root.transform.Find(markerPath); if ((Object)(object)val2 != (Object)null) { list2.Add(new RealizedMarker(markerPath, ToPoint(val2.position), ToPoint(val2.localScale))); } } int num = 0; foreach (string markerGroupPath in markerGroupPaths) { Transform val3 = _root.transform.Find(markerGroupPath); if (!((Object)(object)val3 == (Object)null)) { for (int i = 0; i < val3.childCount; i++) { Transform child = val3.GetChild(i); list2.Add(new RealizedMarker(markerGroupPath + "/" + ((Object)child).name, ToPoint(child.position), ToPoint(child.localScale))); num++; } } } ILogger logger = _logger; if (logger != null) { logger.Log($"[arena] realized at ({((ArenaWorldPoint)(ref origin)).X:0.0}, {((ArenaWorldPoint)(ref origin)).Y:0.0}, {((ArenaWorldPoint)(ref origin)).Z:0.0}); " + $"{list.Count}/{parityPaths.Count} parity nodes, " + $"{list2.Count - num}/{markerPaths.Count} markers, {num} grouped marker(s)"); } return new ArenaRealizationResult(true, (string)null, (IReadOnlyList)list, (IReadOnlyList)list2); } public void Teardown() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); _root = null; ILogger logger = _logger; if (logger != null) { logger.Log("[arena] realized hierarchy destroyed"); } } } private static ArenaWorldPoint ToPoint(Vector3 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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 new ArenaWorldPoint(v.x, v.y, v.z); } } }