Decompiled source of R2M v2.4.0
R2.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using DM; using HarmonyLib; using Landfall; using Landfall.TABC; using Landfall.TABS; using Landfall.TABS.AI; using Landfall.TABS.AI.Systems; using Landfall.TABS.GameMode; using Landfall.TABS.Services; using Landfall.TABS.UnitPlacement; using Landfall.TABS.WinConditions; using Landfall.TABS.Workshop; using TFBGames; using TMPro; using Unity.Entities; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("Main")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Main")] [assembly: AssemblyTitle("Main")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace C3b3z; [HarmonyPriority(800)] [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class SpawnPatch { [HarmonyPostfix] private static void Postfix(UnitBlueprint __instance, ref Unit unitToSpawn, ref GameObject[] __result) { if (!SpawnBan.IsBanned(__instance)) { return; } Unit val = unitToSpawn; if ((Object)(object)val == (Object)null && __result != null) { for (int i = 0; i < __result.Length; i++) { GameObject val2 = __result[i]; if (!((Object)(object)val2 == (Object)null)) { val = val2.GetComponentInChildren<Unit>(true); if ((Object)(object)val != (Object)null) { break; } } } } if ((Object)(object)val != (Object)null) { UnitCorrupt.Corrupt(val); Main.Log.LogWarning((object)"[Spawn] Corrupted respawn: :Die:"); } } } internal static class Blueprint { private sealed class Snapshot { public UnitBlueprint Blueprint; public string BlueprintName; public DatabaseEntity Entity; public string EntityName; public DatabaseID[] PropDatabaseIds; } private static readonly Dictionary<UnitBlueprint, Snapshot> Active = new Dictionary<UnitBlueprint, Snapshot>(); private static readonly FieldInfo EntityField = typeof(UnitBlueprint).GetField("m_entity", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly PropertyInfo EntityProperty = typeof(UnitBlueprint).GetProperty("Entity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly PropertyInfo NameProperty = typeof(DatabaseEntity).GetProperty("Name", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PropDatabaseIdsField = typeof(UnitBlueprint).GetField("m_propDatabaseIds", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo EntityNameField = typeof(DatabaseEntity).GetField("m_Name", BindingFlags.Instance | BindingFlags.NonPublic); internal static void Corrupt(UnitBlueprint blueprint) { if ((Object)(object)blueprint == (Object)null || Active.ContainsKey(blueprint)) { return; } try { DatabaseEntity entity = GetEntity(blueprint); Snapshot snapshot = new Snapshot { Blueprint = blueprint, BlueprintName = ((Object)blueprint).name, Entity = entity, EntityName = ((entity != null) ? GetEntityName(entity) : null), PropDatabaseIds = GetPropDatabaseIds(blueprint) }; Active.Add(blueprint, snapshot); ((Object)blueprint).name = "RAINBOW_CORRUPTED_BP_" + Sanitize(snapshot.BlueprintName); if (entity != null) { string value = ":Die:"; SetEntityName(entity, value); } SetPropDatabaseIds(blueprint, Array.Empty<DatabaseID>()); Main.Log.LogInfo((object)("[BlueprintCorruption] Corrupted UnitBlueprint: " + snapshot.BlueprintName)); } catch (Exception ex) { Main.Log.LogWarning((object)("[BlueprintCorruption] " + ex)); } } internal static void RestoreAll() { foreach (KeyValuePair<UnitBlueprint, Snapshot> item in new List<KeyValuePair<UnitBlueprint, Snapshot>>(Active)) { try { Snapshot value = item.Value; if ((Object)(object)value.Blueprint != (Object)null) { ((Object)value.Blueprint).name = value.BlueprintName; } if (value.Entity != null && value.EntityName != null) { SetEntityName(value.Entity, value.EntityName); } SetPropDatabaseIds(value.Blueprint, value.PropDatabaseIds); } catch { } } Active.Clear(); } internal static bool IsCorrupted(UnitBlueprint blueprint) { if ((Object)(object)blueprint != (Object)null) { return Active.ContainsKey(blueprint); } return false; } internal static string GetHookResponse(UnitBlueprint blueprint) { return NameHook.GetResponse(blueprint, "rainbow"); } private static DatabaseEntity GetEntity(UnitBlueprint blueprint) { if (EntityField != null) { object? value = EntityField.GetValue(blueprint); return (DatabaseEntity)((value is DatabaseEntity) ? value : null); } if (EntityProperty != null) { object? value2 = EntityProperty.GetValue(blueprint, null); return (DatabaseEntity)((value2 is DatabaseEntity) ? value2 : null); } return null; } private static string GetEntityName(DatabaseEntity entity) { try { if (NameProperty != null) { return NameProperty.GetValue(entity, null) as string; } if (EntityNameField != null) { return EntityNameField.GetValue(entity) as string; } } catch { } return null; } private static DatabaseID[] GetPropDatabaseIds(UnitBlueprint blueprint) { try { return (PropDatabaseIdsField != null) ? (PropDatabaseIdsField.GetValue(blueprint) as DatabaseID[]) : null; } catch { return null; } } private static void SetPropDatabaseIds(UnitBlueprint blueprint, DatabaseID[] ids) { try { if (PropDatabaseIdsField != null) { PropDatabaseIdsField.SetValue(blueprint, ids); } } catch { } } private static void SetEntityName(DatabaseEntity entity, string value) { try { if (NameProperty != null && NameProperty.CanWrite) { NameProperty.SetValue(entity, value, null); } else if (EntityNameField != null) { EntityNameField.SetValue(entity, value); } } catch { } } private static string Sanitize(string value) { if (string.IsNullOrEmpty(value)) { return "UNIT"; } return value.Replace("/", "_").Replace("\\", "_").Replace(" ", "_"); } } [DisallowMultipleComponent] public class Cube : MonoBehaviour { private const float MOVE_SPEED = 9f; private const float SCAN_INTERVAL = 0.06f; private const float CORRUPT_RADIUS = 1.6f; private const float ROTATION_SPEED = 90f; private const float CORRUPT_SCALE = 1.4f; private const float MIN_Y = 0.6f; private const float MAX_SAFE_Y = 80f; private const float FALL_RECOVERY_Y = -8f; private const float VERTICAL_DEADZONE = 0.35f; private const float CEILING_CLEARANCE = 0.8f; private const float Y_MOVE_SPEED = 11f; private const float HOVER_HEIGHT = 1.5f; private const float GROUND_PROBE_UP = 60f; private const float GROUND_PROBE_DOWN = 120f; private const float TARGET_HEIGHT_OFFSET = 0.15f; private const float RANGED_RANGE = 90f; private const float RANGED_COOLDOWN = 1.35f; private const int MAX_RANGED_SHOTS_BEFORE_MELEE = 3; private const float BLACKHOLE_RADIUS = 24f; private const float BLACKHOLE_DEFORM_RADIUS = 18f; private const float BLACKHOLE_FORCE = 260f; private const float BLACKHOLE_DAMAGE = float.MaxValue; private const float BLACKHOLE_DEFORM_STRENGTH = 7.5f; private const float CORRUPT_LIFETIME = 20f; private const float WEIGHT_DIST = 1f; private const float WEIGHT_RANGED_PREF = 0.5f; private const float WEIGHT_MUST_KILL = 9999f; private static readonly string[] CORRUPT_NAMES = new string[8] { "[Die]", "[Cube]", "[Error404]", "[PHANTOM]", "[ok]", "[NotFound]", "[NULL]", "[Return]" }; private static readonly FieldInfo s_bpEntityField = typeof(UnitBlueprint).GetField("m_entity", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo s_entityGuidField = typeof(DatabaseEntity).GetField("m_GUID", BindingFlags.Instance | BindingFlags.NonPublic) ?? typeof(DatabaseEntity).GetField("guid", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo s_entityNameField = typeof(DatabaseEntity).GetField("m_Name", BindingFlags.Instance | BindingFlags.NonPublic) ?? typeof(DatabaseEntity).GetField("name", BindingFlags.Instance | BindingFlags.NonPublic); private string _cubeName; private Team _dummyTeam; private Unit _target; private float _scanTimer; private float _birthTime; private float _attackTimer; private Vector3 _fixedScale; private Renderer _rend; private bool _isCorrupted; private bool _attackAlliesWhenCorrupted; private Material _cubeMat; private Vector3 _spawnPosition; private Vector3 _lastSafePosition; private float _rangedTimer; private int _rangedShotsSinceMelee; private float _specialRainbowTimer; private int _specialRainbowMisses; private float _geometryHoleTimer; private float _laserTimer; private const float GEOMETRY_HOLE_COOLDOWN = 2.75f; private const float GEOMETRY_HOLE_SPEED = 58f; private const float GEOMETRY_HOLE_LIFETIME = 4.25f; private const float GEOMETRY_HOLE_RADIUS = 2.75f; private const float LASER_COOLDOWN = 0.08f; private Material _dissolveMat; private static readonly int DissolveAmount = Shader.PropertyToID("_DissolveAmount"); private bool _mustKillCacheValid; private Unit _mustKillTarget; private Rigidbody _rb; private float _meleeCooldown; private float _postMeleeProtectTimer; private bool _meleeBusy; private float _impactCooldown; private Unit _sourceUnit; private float _rollForce = 18f; private float _timeBreakTimer = 4f; private const float TIME_BREAK_RANGE = 38f; private const float TIME_BREAK_COOLDOWN = 7f; private const float ATTACK_INTERVAL = 0.55f; private const float MIN_GROUND_CLEARANCE = 0.8f; internal Team DummyTeam => _dummyTeam; public void Init(string n, Team dummyTeam, bool isCorrupted = false) { //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) _cubeName = n; _dummyTeam = dummyTeam; _isCorrupted = isCorrupted; _attackAlliesWhenCorrupted = isCorrupted; } private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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) _birthTime = Time.time; _spawnPosition = ((Component)this).transform.position; _lastSafePosition = ((Component)this).transform.position; _rangedTimer = 1.35f; _rangedShotsSinceMelee = 0; _specialRainbowTimer = 3f; _specialRainbowMisses = 0; _geometryHoleTimer = 1f; _laserTimer = 0.75f; _meleeCooldown = 0f; _postMeleeProtectTimer = 0f; _meleeBusy = false; _impactCooldown = 0f; _attackTimer = 0f; _fixedScale = ((Component)this).transform.localScale; if (((Vector3)(ref _fixedScale)).sqrMagnitude < 0.0001f) { _fixedScale = Vector3.one; } ((Component)this).transform.localScale = _fixedScale; _rend = ((Component)this).GetComponent<Renderer>(); if ((Object)(object)_rend != (Object)null) { _cubeMat = _rend.material; } _rb = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)_rb == (Object)null) { _rb = ((Component)this).gameObject.AddComponent<Rigidbody>(); } _rb.useGravity = false; _rb.isKinematic = true; if (_isCorrupted) { SetupDissolveMaterial(); ((MonoBehaviour)this).StartCoroutine(DissolveTimer()); } } private void OnDestroy() { if (!_isCorrupted) { EntityGuard.NotifyCubeRemoved(); CubeSpawn.OnCubeDestroyed(this); } if ((Object)(object)_dissolveMat != (Object)null) { Object.Destroy((Object)(object)_dissolveMat); } } private void Update() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) _meleeCooldown -= Time.unscaledDeltaTime; _postMeleeProtectTimer -= Time.unscaledDeltaTime; _scanTimer -= Time.unscaledDeltaTime; _rangedTimer -= Time.unscaledDeltaTime; _specialRainbowTimer -= Time.unscaledDeltaTime; _geometryHoleTimer -= Time.unscaledDeltaTime; _laserTimer -= Time.unscaledDeltaTime; _impactCooldown -= Time.unscaledDeltaTime; _timeBreakTimer -= Time.unscaledDeltaTime; _attackTimer -= Time.unscaledDeltaTime; ((Component)this).transform.localScale = _fixedScale; if (IsOriginalImmortalCube() && _timeBreakTimer <= 0f) { _timeBreakTimer = 7f; TimeBreak.TryStart(((Component)this).transform.position, _target, 38f, 0.9f); } AnimateCube(); if ((Object)(object)_target == (Object)null || ((Object)(object)_target.data != (Object)null && _target.data.Dead) || TargetFilter.ShouldIgnore(_target)) { _target = null; } if (_scanTimer <= 0f) { _scanTimer = 0.06f; _mustKillCacheValid = false; Unit val = FindBestTarget(); if ((Object)(object)val != (Object)null) { _target = val; } } if ((Object)(object)_target != (Object)null) { ChaseAndCorrupt(); } AntiNoclip(); if ((Object)(object)_target == (Object)null) { return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)_target).transform.position); if (!_isCorrupted && _rangedShotsSinceMelee < 3 && _rangedTimer <= 0f && num <= 90f) { FireDistortionBlast(_target); _rangedShotsSinceMelee++; _rangedTimer = 1.35f; } if (IsOriginalImmortalCube() && _specialRainbowTimer <= 0f) { _specialRainbowTimer = 3.25f; _specialRainbowMisses++; if (Random.value <= 0.08f || _specialRainbowMisses >= 24) { Vector3 val2; Vector3 val3; if (!((Object)(object)_target != (Object)null)) { val2 = ((Component)this).transform.forward; } else if (!((Object)(object)_target.data != (Object)null) || !((Object)(object)_target.data.mainRig != (Object)null)) { val3 = ((Component)_target).transform.position - ((Component)this).transform.position; val2 = ((Vector3)(ref val3)).normalized; } else { val3 = _target.data.mainRig.position - ((Component)this).transform.position; val2 = ((Vector3)(ref val3)).normalized; } Vector3 direction = val2; if ((Object)(object)CubeSpawn.SpawnRainbowSpecialProjectile(((Component)this).transform.position, direction, ((Component)this).gameObject) != (Object)null) { _specialRainbowMisses = 0; } } } if (IsOriginalImmortalCube() && _geometryHoleTimer <= 0f) { _geometryHoleTimer = 2.75f; FireGeometryHoleProjectile(); } if (IsOriginalImmortalCube() && _laserTimer <= 0f) { _laserTimer = 0.08f; FireCorruptionLaser(); } ((Component)this).transform.localScale = _fixedScale; } private void AntiNoclip() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0060: 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_0121: 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_006e: 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_0080: 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_0040: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position; if (float.IsNaN(val.x) || float.IsNaN(val.y) || float.IsNaN(val.z) || float.IsInfinity(val.x) || float.IsInfinity(val.y) || float.IsInfinity(val.z)) { val = _lastSafePosition; } bool num = val.y < -8f; bool flag = Mathf.Abs(val.x) > 500f || Mathf.Abs(val.z) > 500f; if (num || flag) { Vector3 val2 = _lastSafePosition; if (val2.y < 1f || Mathf.Abs(val2.x) > 500f || Mathf.Abs(val2.z) > 500f) { val2 = _spawnPosition; } val2.y = Mathf.Max(1f, val2.y); val = val2; try { _rb.velocity = Vector3.zero; _rb.angularVelocity = Vector3.zero; } catch { } } if (val.y < 0.8f) { val.y = Mathf.Max(0.8f, _lastSafePosition.y); } float num2 = ((!((Object)(object)_target != (Object)null)) ? _spawnPosition.y : (((Object)(object)_target.data != (Object)null && (Object)(object)_target.data.mainRig != (Object)null) ? _target.data.mainRig.position.y : ((Component)_target).transform.position.y)); float num3 = float.NegativeInfinity; RaycastHit[] array = Physics.RaycastAll(new Vector3(val.x, Mathf.Max(val.y + 1f, num2 + 60f), val.z), Vector3.down, 180f, -5, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (!((Object)(object)((RaycastHit)(ref val3)).collider == (Object)null) && !((Component)((RaycastHit)(ref val3)).collider).transform.IsChildOf(((Component)this).transform)) { float y = ((RaycastHit)(ref val3)).point.y; if (y <= num2 + 0.9f && y > num3) { num3 = y; } } } float num4 = (float.IsNegativeInfinity(num3) ? 0.6f : (num3 + 1.5f)); float num5 = num2 + 0.15f; if (Mathf.Abs(num5 - val.y) < 0.35f) { num5 = val.y; } num5 = Mathf.Max(num5, num4); RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val, Vector3.up, ref val4, 12f, -5, (QueryTriggerInteraction)1) && (Object)(object)((RaycastHit)(ref val4)).collider != (Object)null && !((Component)((RaycastHit)(ref val4)).collider).transform.IsChildOf(((Component)this).transform)) { num5 = Mathf.Min(num5, ((RaycastHit)(ref val4)).point.y - 0.8f); } num5 = Mathf.Clamp(num5, 0.8f, 80f); val.y = Mathf.MoveTowards(val.y, num5, 11f * Time.unscaledDeltaTime); if (val.y >= 0.6f && val.y <= 80f) { _lastSafePosition = val; } ((Component)this).transform.position = val; } private void AnimateCube() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0174: Unknown result type (might be due to invalid IL or missing references) float num = Time.time - _birthTime; ((Component)this).transform.Rotate(Vector3.up, 63f * Time.unscaledDeltaTime, (Space)0); ((Component)this).transform.Rotate(Vector3.right, 36f * Time.unscaledDeltaTime, (Space)0); if ((Object)(object)_rend == (Object)null) { _rend = ((Component)this).GetComponent<Renderer>(); } if ((Object)(object)_rend == (Object)null) { return; } if ((Object)(object)_cubeMat == (Object)null) { _cubeMat = _rend.material; } if (!((Object)(object)_cubeMat == (Object)null)) { _rend.enabled = true; float num2 = Mathf.Sin(num * 5f) * 0.5f + 0.5f; Color val = new Color(0.75f, 0.02f, 0.02f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.02f, 0.35f, 1f); Color val3 = Color.Lerp(val, val2, num2); if (_isCorrupted) { val3 = Color.Lerp(Color.black, new Color(1f, 0.02f, 0.8f), num2); } if (_cubeMat.HasProperty("_Color")) { _cubeMat.color = val3; } if (_cubeMat.HasProperty("_EmissionColor")) { _cubeMat.EnableKeyword("_EMISSION"); _cubeMat.SetColor("_EmissionColor", val3 * (1.5f + num2 * 2f)); } } } private Unit FindBestTarget() { //IL_00a7: 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_00bc: Unknown result type (might be due to invalid IL or missing references) Unit[] array = Object.FindObjectsOfType<Unit>(); Unit result = null; float num = float.MaxValue; float num2 = 32400f; Unit[] array2 = array; foreach (Unit val in array2) { if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)((Component)this).GetComponent<Unit>() || (Object)(object)val.data == (Object)null || val.data.Dead || TargetFilter.ShouldIgnore(val) || (Object)(object)((Component)val).GetComponent<CorruptMark>() != (Object)null || (Object)(object)((Component)val).GetComponent<CubeMark>() != (Object)null || (Object)(object)((Component)val).GetComponent<UnitCorrupt>() != (Object)null) { continue; } Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num2)) { float num3 = sqrMagnitude * 1f; if (IsUnitLikelyMustKill(val)) { num3 -= 9999f; } if (sqrMagnitude <= 8100f) { num3 -= 0.5f; } if (num3 < num) { num = num3; result = val; } } } return result; } private bool IsUnitLikelyMustKill(Unit unit) { if ((Object)(object)unit == (Object)null) { return false; } if (_mustKillCacheValid && (Object)(object)unit == (Object)(object)_mustKillTarget) { return true; } try { string unitDisplayName = GetUnitDisplayName(unit); for (int i = 0; i < CORRUPT_NAMES.Length; i++) { if (unitDisplayName.IndexOf(CORRUPT_NAMES[i], StringComparison.OrdinalIgnoreCase) >= 0) { _mustKillTarget = unit; _mustKillCacheValid = true; return true; } } } catch { } return false; } private string GetUnitDisplayName(Unit unit) { if ((Object)(object)unit == (Object)null) { return string.Empty; } string result = ((Object)unit).name ?? string.Empty; try { if ((Object)(object)unit.unitBlueprint == (Object)null) { return result; } UnitBlueprint unitBlueprint = unit.unitBlueprint; if (s_bpEntityField == null) { return result; } object value = s_bpEntityField.GetValue(unitBlueprint); if (value == null) { return result; } if (s_entityNameField != null) { object value2 = s_entityNameField.GetValue(value); if (value2 != null) { return value2.ToString(); } } } catch { } return result; } private bool IsOriginalImmortalCube() { if (!_isCorrupted && !string.IsNullOrEmpty(_cubeName)) { return ((Object)((Component)this).gameObject).name.IndexOf("PHANTOM_CUBE_", StringComparison.OrdinalIgnoreCase) >= 0; } return false; } private void ChaseAndCorrupt() { //IL_0045: 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_0071: 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_007f: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_target == (Object)null)) { Vector3 val = (((Object)(object)_target.data != (Object)null && (Object)(object)_target.data.mainRig != (Object)null) ? _target.data.mainRig.position : ((Component)_target).transform.position) - ((Component)this).transform.position; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); if (((Vector3)(ref val2)).magnitude > 1.6f) { Vector3 val3 = ((Vector3)(ref val2)).normalized * 9f * Time.unscaledDeltaTime; Transform transform = ((Component)this).transform; transform.position += new Vector3(val3.x, 0f, val3.z); } if (_meleeCooldown <= 0f && ((Vector3)(ref val)).sqrMagnitude <= 2.5600002f) { TryMeleeAttack(_target); } } } private void FireDistortionBlast(Unit target) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_007f: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bc: 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_0103: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)target == (Object)null)) { Vector3 val = (((Object)(object)target.data != (Object)null && (Object)(object)target.data.mainRig != (Object)null) ? target.data.mainRig.position : ((Component)target).transform.position) - ((Component)this).transform.position; if (!(((Vector3)(ref val)).sqrMagnitude < 0.001f)) { GameObject val2 = new GameObject("C3b3z_DistortionBlast_Tesseract4D"); val2.transform.position = ((Component)this).transform.position + ((Vector3)(ref val)).normalized * 0.45f; val2.transform.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized); val2.transform.localScale = Vector3.one * 1.25f; val2.AddComponent<TempObj>(); val2.AddComponent<CubeProj>().Initialize(((Component)this).gameObject); val2.AddComponent<CubeVisual>().Initialize(2.2f, 0.075f, rainbow: true); ((MonoBehaviour)this).StartCoroutine(DistortionBlastRoutine(val2, ((Vector3)(ref val)).normalized, 0.8f, target)); } } } private IEnumerator DistortionBlastRoutine(GameObject projectile, Vector3 dir, float life, Unit target) { //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 t = 0f; while ((Object)(object)projectile != (Object)null && t < life) { t += Time.unscaledDeltaTime; Transform transform = projectile.transform; transform.position += dir * 42f * Time.unscaledDeltaTime; projectile.transform.Rotate(360f * Time.unscaledDeltaTime, 480f * Time.unscaledDeltaTime, 720f * Time.unscaledDeltaTime); if ((Object)(object)target != (Object)null) { Vector3 val = (((Object)(object)target.data != (Object)null && (Object)(object)target.data.mainRig != (Object)null) ? target.data.mainRig.position : ((Component)target).transform.position); Vector3 val2 = projectile.transform.position - val; if (((Vector3)(ref val2)).sqrMagnitude < 1.6899998f) { try { if ((Object)(object)target.data != (Object)null && (Object)(object)target.data.healthHandler != (Object)null) { ((Damagable)target.data.healthHandler).TakeDamage(35f, dir, (Unit)null, (DamageType)0); } } catch { } Impact.Deform(((Component)target).gameObject, projectile.transform.position); break; } } yield return null; } if ((Object)(object)projectile != (Object)null) { Object.Destroy((Object)(object)projectile); } } private void FireCorruptionLaser() { //IL_0005: 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_0022: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown try { GameObject val = new GameObject("C3b3z_CorruptionLaser_Attachment"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = Vector3.forward * 0.75f; val.transform.localRotation = Quaternion.identity; val.AddComponent<CubeLaser>().Initialize(); Object.Destroy((Object)val, 0.24f); } catch (Exception ex) { try { Main.Log.LogWarning((object)("[Laser] spawn failed: " + ex.Message)); } catch { } } } private void FireGeometryHoleProjectile() { //IL_0026: 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_003b: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) Vector3 val; if (!((Object)(object)_target != (Object)null)) { val = ((Component)this).transform.forward; } else { Vector3 val2 = ((Component)_target).transform.position - ((Component)this).transform.position; if (!(((Vector3)(ref val2)).sqrMagnitude > 0.001f)) { val = ((Component)this).transform.forward; } else { val2 = ((Component)_target).transform.position - ((Component)this).transform.position; val = ((Vector3)(ref val2)).normalized; } } Vector3 val3 = val; GameObject val4 = new GameObject("C3b3z_HypercubeProjectile"); val4.AddComponent<TempObj>(); val4.AddComponent<CubeProj>().Initialize(((Component)this).gameObject); val4.transform.position = ((Component)this).transform.position + val3 * 2.6f; val4.transform.rotation = Quaternion.LookRotation(val3); val4.transform.localScale = Vector3.one * 2.75f; val4.AddComponent<CubeVisual>().Initialize(5f, 0.095f, rainbow: true); val4.AddComponent<CubeAttack>().Initialize(val3, 58f, 4.25f, 2.75f, ((Component)this).gameObject); if (Main.Log != null) { Main.Log.LogInfo((object)"[Hypercube] Fired tesseract projectile."); } } private void OnCollisionEnter(Collision col) { //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_00c0: Unknown result type (might be due to invalid IL or missing references) if (col != null && !((Object)(object)col.gameObject == (Object)null) && !CubeRules.ShouldIgnore(col.gameObject, ((Component)this).gameObject)) { Unit componentInParent = col.gameObject.GetComponentInParent<Unit>(); if ((Object)(object)componentInParent != (Object)null) { TryMeleeAttack(componentInParent); } Vector3 impulse = col.impulse; if (!(((Vector3)(ref impulse)).magnitude < 5f) && !((Object)(object)col.gameObject.GetComponent<CubeRoll>() != (Object)null) && !((Object)(object)col.gameObject.GetComponentInParent<CubeMark>() != (Object)null) && !CubeRules.IsProjectile(col.gameObject) && !((Object)(object)col.gameObject.GetComponentInParent<TempObj>() != (Object)null) && col.contacts != null && col.contacts.Length != 0) { OnImpact(((ContactPoint)(ref col.contacts[0])).point); } } } private void TryMeleeAttack(Unit unit) { //IL_016a: 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_01aa: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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_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_0092: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) if (_meleeBusy || _meleeCooldown > 0f || (Object)(object)unit == (Object)null || (Object)(object)unit.data == (Object)null || unit.data.Dead || TargetFilter.ShouldIgnore(unit) || (Object)(object)((Component)unit).GetComponent<CorruptMark>() != (Object)null || (Object)(object)((Component)unit).GetComponent<CubeMark>() != (Object)null) { return; } Vector3 val = (((Object)(object)unit.data.mainRig != (Object)null) ? unit.data.mainRig.position : ((Component)unit).transform.position); Vector3 val2 = val - ((Component)this).transform.position; if (((Vector3)(ref val2)).sqrMagnitude > 4.6080003f) { return; } _meleeCooldown = 0.55f; _meleeBusy = true; _rangedShotsSinceMelee = 0; _sourceUnit = unit; bool flag = false; try { HealthHandler healthHandler = unit.data.healthHandler; if ((Object)(object)healthHandler != (Object)null) { Vector3 val3 = val - ((Component)this).transform.position; if (((Vector3)(ref val3)).sqrMagnitude < 0.001f) { val3 = ((Component)this).transform.forward; } ((Damagable)healthHandler).TakeDamage(60f, ((Vector3)(ref val3)).normalized, (Unit)null, (DamageType)0); flag = true; } } catch (Exception ex) { try { Main.Log.LogWarning((object)("[Cube] Melee damage failed: " + ex.Message)); } catch { } } try { UnitCorrupt.Corrupt(unit); } catch { } try { Impact.Deform(((Component)unit).gameObject, val); } catch { } DataHandler componentInChildren = ((Component)unit).GetComponentInChildren<DataHandler>(); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.mainRig != (Object)null && !componentInChildren.mainRig.isKinematic) { try { Vector3 val4 = val - ((Component)this).transform.position; if (((Vector3)(ref val4)).sqrMagnitude < 0.001f) { val4 = Vector3.forward; } ((Vector3)(ref val4)).Normalize(); val4.y = 0.8f; componentInChildren.mainRig.AddForce(((Vector3)(ref val4)).normalized * (flag ? 220f : 120f), (ForceMode)1); } catch { } } Runner.Run(MeleeRecovery()); } private IEnumerator MeleeRecovery() { float t = 0f; while (t < 0.12f) { t += Time.unscaledDeltaTime; yield return null; } _meleeBusy = false; _postMeleeProtectTimer = 0.12f; } private IEnumerator MeleeHitRoutine(Unit unit, Collider[] unitColliders, Collider[] cubeColliders) { try { if ((Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && (Object)(object)unit.data.healthHandler != (Object)null) { HealthHandler healthHandler = unit.data.healthHandler; Vector3 val = ((Component)unit).transform.position - ((Component)this).transform.position; ((Damagable)healthHandler).TakeDamage(60f, ((Vector3)(ref val)).normalized, (Unit)null, (DamageType)0); } } catch { } float t = 0f; while (t < 0.22f) { t += Time.unscaledDeltaTime; if ((Object)(object)unit != (Object)null) { try { Impact.Deform(((Component)unit).gameObject, ((Component)this).transform.position); } catch { } } yield return null; } foreach (Collider val2 in unitColliders) { if ((Object)(object)val2 == (Object)null) { continue; } foreach (Collider val3 in cubeColliders) { if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3 == (Object)(object)val2)) { try { Physics.IgnoreCollision(val3, val2, false); } catch { } } } } _meleeBusy = false; _postMeleeProtectTimer = 0.35f; _rangedShotsSinceMelee = 0; } private void OnImpact(Vector3 impactPos) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!_meleeBusy && !(_impactCooldown > 0f)) { _impactCooldown = 0.4f; SpawnImpactFragments(impactPos); if ((Object)(object)_sourceUnit != (Object)null) { Runner.Run(CorruptAndErase(_sourceUnit)); } } } private static IEnumerator CorruptAndErase(Unit unit) { if ((Object)(object)unit == (Object)null) { yield break; } if ((Object)(object)((Component)unit).GetComponent<CorruptMark>() == (Object)null) { ((Component)unit).gameObject.AddComponent<CorruptMark>(); } Renderer[] renderers = ((Component)unit).GetComponentsInChildren<Renderer>(true); float t = 0f; Renderer[] array; while (t < 0.5f) { t += Time.unscaledDeltaTime; array = renderers; foreach (Renderer val in array) { if (!((Object)(object)val == (Object)null)) { Transform transform = ((Component)val).transform; transform.localPosition += Random.insideUnitSphere * 0.3f * Time.unscaledDeltaTime * 60f; if (Random.value < 0.1f) { val.enabled = !val.enabled; } } } yield return null; } array = renderers; foreach (Renderer val2 in array) { if ((Object)(object)val2 != (Object)null) { val2.enabled = false; } } yield return (object)new WaitForSecondsRealtime(0.15f); if ((Object)(object)unit != (Object)null && (Object)(object)((Component)unit).gameObject != (Object)null) { CubeGuard.FlagIntentionalDestroy(((Component)unit).gameObject); Object.Destroy((Object)(object)((Component)unit).gameObject); yield return null; if ((Object)(object)unit != (Object)null && (Object)(object)((Component)unit).gameObject != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)unit).gameObject); } } } private void SetupDissolveMaterial() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown if ((Object)(object)_rend == (Object)null) { _rend = ((Component)this).GetComponent<Renderer>(); } if (!((Object)(object)_rend == (Object)null)) { Shader val = (((Object)(object)_rend.material != (Object)null) ? _rend.material.shader : Shader.Find("Standard")); if ((Object)(object)val == (Object)null) { val = Shader.Find("Standard"); } _dissolveMat = new Material(val); _dissolveMat.CopyPropertiesFromMaterial(_rend.material); ((Object)_dissolveMat).name = "C3b3z_DissolveRuntime"; _rend.material = _dissolveMat; if (_dissolveMat.HasProperty(DissolveAmount)) { _dissolveMat.SetFloat(DissolveAmount, 0f); } } } private IEnumerator DissolveTimer() { float t = 0f; while (t < 20f && (Object)(object)this != (Object)null) { t += Time.unscaledDeltaTime; float num = Mathf.Clamp01(t / 20f); if ((Object)(object)_dissolveMat != (Object)null && _dissolveMat.HasProperty(DissolveAmount)) { _dissolveMat.SetFloat(DissolveAmount, num); } yield return null; } if ((Object)(object)_dissolveMat != (Object)null && _dissolveMat.HasProperty(DissolveAmount)) { _dissolveMat.SetFloat(DissolveAmount, 0.85f); } } private void SpawnImpactFragments(Vector3 pos) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_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) //IL_006d: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00c7: 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) Vector3 insideUnitSphere; if ((Object)(object)ScreenShake.Instance != (Object)null) { ScreenShake instance = ScreenShake.Instance; insideUnitSphere = Random.insideUnitSphere; instance.AddForce(((Vector3)(ref insideUnitSphere)).normalized * 0.25f, pos); } for (int i = 0; i < 16; i++) { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)obj).name = "BallImpactFrag"; obj.transform.position = pos; obj.transform.localScale = Vector3.one * Random.Range(0.08f, 0.25f); obj.AddComponent<TempObj>(); Object.Destroy((Object)(object)obj.GetComponent<Collider>()); Renderer component = obj.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { Material val = new Material(Shader.Find("Standard")); float num = Random.Range(0f, 0.08f); val.color = Color.HSVToRGB(num, 1f, 1f); val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", Color.HSVToRGB(num, 1f, 6f)); component.material = val; } Rigidbody obj2 = obj.AddComponent<Rigidbody>(); obj2.useGravity = true; insideUnitSphere = Random.insideUnitSphere; obj2.velocity = ((Vector3)(ref insideUnitSphere)).normalized * Random.Range(10f, 30f); obj2.angularVelocity = Random.insideUnitSphere * 20f; Object.Destroy((Object)(object)obj, 1.2f); } } private void RollTowardsNearest() { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) if ((Object)(object)_rb == (Object)null) { return; } Unit[] array = Object.FindObjectsOfType<Unit>(); Unit val = null; float num = float.MaxValue; Unit[] array2 = array; foreach (Unit val2 in array2) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.data == (Object)null) && !val2.data.Dead && !TargetFilter.ShouldIgnore(val2) && !((Object)(object)((Component)val2).GetComponent<CorruptMark>() != (Object)null) && !((Object)(object)((Component)val2).GetComponent<CubeMark>() != (Object)null) && !((Object)(object)((Component)val2).GetComponent<UnitCorrupt>() != (Object)null)) { float num2 = Vector3.SqrMagnitude(((Component)val2).transform.position - ((Component)this).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val == (Object)null) { return; } Vector3 val3 = ((Component)val).transform.position - ((Component)this).transform.position; val3.y = 0f; if (!(((Vector3)(ref val3)).sqrMagnitude < 0.01f)) { if (_rb.isKinematic) { Transform transform = ((Component)this).transform; transform.position += ((Vector3)(ref val3)).normalized * _rollForce * 0.08f * Time.unscaledDeltaTime; } else { _rb.AddForce(((Vector3)(ref val3)).normalized * _rollForce, (ForceMode)0); _rb.AddTorque(Vector3.Cross(Vector3.up, ((Vector3)(ref val3)).normalized) * _rollForce * 0.8f, (ForceMode)0); } } } } public class CorruptMark : MonoBehaviour { } internal sealed class CubeRoll : MonoBehaviour { } public sealed class CubeProjAttack : MonoBehaviour { private Vector3 _direction; private GameObject _owner; private float _speed; private float _life; private bool _hit; private bool _gracePassed; private readonly HashSet<Collider> _ownerColliders = new HashSet<Collider>(); public void Initialize(Vector3 direction, GameObject owner, float speed, float lifetime) { //IL_0018: 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_001d: Unknown result type (might be due to invalid IL or missing references) _direction = ((((Vector3)(ref direction)).sqrMagnitude > 0.001f) ? ((Vector3)(ref direction)).normalized : Vector3.forward); _owner = owner; _speed = speed; _life = lifetime; _gracePassed = false; _ownerColliders.Clear(); Collider[] componentsInChildren; if ((Object)(object)_owner != (Object)null) { try { componentsInChildren = _owner.GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren) { if ((Object)(object)val != (Object)null) { _ownerColliders.Add(val); } } } catch { } } componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { try { val2.enabled = false; } catch { } } } } private void Update() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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) if (_hit) { return; } EnsureProjectileVisible(); _life -= Time.unscaledDeltaTime; if (_life <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Vector3 position = ((Component)this).transform.position; Vector3 val = _direction * _speed * Time.unscaledDeltaTime; Transform transform = ((Component)this).transform; transform.position += val; ((Component)this).transform.Rotate(Vector3.up, 900f * Time.unscaledDeltaTime, (Space)0); ((Component)this).transform.Rotate(Vector3.right, 610f * Time.unscaledDeltaTime, (Space)1); if (!_gracePassed) { _gracePassed = true; return; } float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude > 0.001f)) { return; } RaycastHit[] array = Physics.SphereCastAll(position, 0.18f, ((Vector3)(ref val)).normalized, magnitude, -5, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { Collider collider = ((RaycastHit)(ref array[i])).collider; if ((Object)(object)collider == (Object)null) { continue; } if ((Object)(object)_owner != (Object)null) { Transform transform2 = ((Component)collider).transform; Transform transform3 = _owner.transform; if ((Object)(object)transform2 == (Object)(object)transform3 || transform2.IsChildOf(transform3) || transform3.IsChildOf(transform2)) { continue; } } GameObject val2 = ResolveTarget(collider); if (!CubeRules.ShouldIgnore(val2, _owner) && (Object)(object)val2 != (Object)null && CanHit(val2, collider)) { Hit(val2, ((RaycastHit)(ref array[i])).point); break; } } } private void EnsureProjectileVisible() { try { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)null) { componentsInChildren[i].enabled = true; } } } catch { } } private GameObject ResolveTarget(Collider collider) { if ((Object)(object)collider == (Object)null) { return null; } Rigidbody attachedRigidbody = collider.attachedRigidbody; if ((Object)(object)attachedRigidbody != (Object)null) { return ((Component)attachedRigidbody).gameObject; } MeshFilter component = ((Component)collider).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null) { return ((Component)component).gameObject; } SkinnedMeshRenderer component2 = ((Component)collider).GetComponent<SkinnedMeshRenderer>(); if ((Object)(object)component2 != (Object)null) { return ((Component)component2).gameObject; } return ((Component)collider).gameObject; } private bool CanHit(GameObject target, Collider hitCollider) { if ((Object)(object)target == (Object)null) { return false; } if ((Object)(object)hitCollider != (Object)null && _ownerColliders.Contains(hitCollider)) { return false; } if ((Object)(object)target == (Object)(object)((Component)this).gameObject || target.transform.IsChildOf(((Component)this).transform) || ((Component)this).transform.IsChildOf(target.transform)) { return false; } if ((Object)(object)_owner != (Object)null) { if ((Object)(object)target == (Object)(object)_owner) { return false; } if (target.transform.IsChildOf(_owner.transform)) { return false; } if (_owner.transform.IsChildOf(target.transform)) { return false; } if ((Object)(object)target.GetComponentInParent<CubeGuard>() != (Object)null) { return false; } if ((Object)(object)target.GetComponentInParent<CubeMark>() != (Object)null) { return false; } if ((Object)(object)target.GetComponentInParent<Cube>() != (Object)null) { return false; } Rigidbody component = target.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { foreach (Collider ownerCollider in _ownerColliders) { if ((Object)(object)ownerCollider != (Object)null && (Object)(object)ownerCollider.attachedRigidbody == (Object)(object)component) { return false; } } } } if ((Object)(object)target.GetComponentInParent<Cube>() != (Object)null) { return false; } if (CubeRules.IsProjectile(target)) { return false; } if ((Object)(object)target.GetComponentInParent<CubeMark>() != (Object)null) { return false; } if ((Object)(object)target.GetComponentInParent<CubeVisual>() != (Object)null) { return false; } if ((Object)(object)target.GetComponentInParent<CubeAttack>() != (Object)null) { return false; } string text = ((Object)target).name ?? string.Empty; if (text.IndexOf("BlackHole", StringComparison.OrdinalIgnoreCase) >= 0) { return false; } if (text.IndexOf("Hypercube", StringComparison.OrdinalIgnoreCase) >= 0) { return false; } if (text.IndexOf("GeometryHole", StringComparison.OrdinalIgnoreCase) >= 0) { return false; } if (text.IndexOf("PHANTOM_CUBE_", StringComparison.OrdinalIgnoreCase) >= 0) { return false; } return true; } private void Hit(GameObject target, Vector3 point) { //IL_0008: 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_0036: 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) _hit = true; Impact.Corrupt(target, point, _owner, ((Component)this).gameObject); if ((Object)(object)ScreenShake.Instance != (Object)null) { ScreenShake.Instance.AddForce(Random.onUnitSphere * 6f, point); } Object.Destroy((Object)(object)((Component)this).gameObject); } } public sealed class Corrupt : MonoBehaviour { private readonly List<MeshFilter> _meshes = new List<MeshFilter>(); private readonly List<SkinnedMeshRenderer> _skinned = new List<SkinnedMeshRenderer>(); private Vector3 _point; private float _life; private float _rotateTimer; private float _meshTimer; private int _seed; public void Initialize(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) _point = point; _life = 2.4f; _rotateTimer = 0f; _meshTimer = 0f; _seed = ((Object)this).GetInstanceID(); RefreshMeshes(); } private void Update() { if (!((Object)(object)((Component)this).transform == (Object)null)) { _life -= Time.unscaledDeltaTime; _rotateTimer -= Time.unscaledDeltaTime; _meshTimer -= Time.unscaledDeltaTime; if (_rotateTimer <= 0f) { _rotateTimer = 0.08f; RandomRotate(); } if (_meshTimer <= 0f) { _meshTimer = 0.055f; Deform(); } if (_life <= 0f) { Object.Destroy((Object)(object)this); } } } private void RefreshMeshes() { _meshes.Clear(); _skinned.Clear(); MeshFilter[] array = null; SkinnedMeshRenderer[] array2 = null; try { array = ((Component)this).GetComponentsInChildren<MeshFilter>(true); } catch { } try { array2 = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(true); } catch { } if (array != null) { foreach (MeshFilter val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).GetComponentInParent<Cube>() != (Object)null) && !((Object)(object)((Component)val).GetComponentInParent<CubeProjAttack>() != (Object)null) && !((Object)(object)((Component)val).GetComponentInParent<CubeAttack>() != (Object)null)) { _meshes.Add(val); } } } if (array2 == null) { return; } foreach (SkinnedMeshRenderer val2 in array2) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).GetComponentInParent<Cube>() != (Object)null) && !((Object)(object)((Component)val2).GetComponentInParent<CubeProjAttack>() != (Object)null) && !((Object)(object)((Component)val2).GetComponentInParent<CubeAttack>() != (Object)null)) { _skinned.Add(val2); } } } private void RandomRotate() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) try { float num = 18f + Mathf.PingPong(Time.time * 36f, 28f); Vector3 up = default(Vector3); ((Vector3)(ref up))..ctor(Mathf.Sin(Time.time * 7.3f + (float)_seed), Mathf.Cos(Time.time * 5.1f + (float)_seed * 0.17f), Mathf.Sin(Time.time * 9.4f + (float)_seed * 0.31f)); if (((Vector3)(ref up)).sqrMagnitude < 0.001f) { up = Vector3.up; } ((Component)this).transform.Rotate(((Vector3)(ref up)).normalized, num, (Space)0); } catch { } } private void Deform() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _meshes.Count; i++) { DeformMesh(_meshes[i], _point); } for (int j = 0; j < _skinned.Count; j++) { DeformSkinnedMesh(_skinned[j], _point); } } private static void DeformMesh(MeshFilter filter, Vector3 worldPoint) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0094: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)filter == (Object)null) { return; } Mesh mesh; try { mesh = filter.mesh; } catch { return; } if ((Object)(object)mesh == (Object)null || mesh.vertexCount == 0) { return; } Vector3[] vertices = mesh.vertices; Vector3 val = ((Component)filter).transform.InverseTransformPoint(worldPoint); Bounds bounds = mesh.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; float num = Mathf.Max(((Vector3)(ref extents)).magnitude * 0.9f, 0.35f); float num2 = Mathf.Max(num * 0.06f, 0.015f); float time = Time.time; Vector3 val4 = default(Vector3); for (int i = 0; i < vertices.Length; i++) { Vector3 val2 = vertices[i] - val; float magnitude = ((Vector3)(ref val2)).magnitude; float num3 = 1f - Mathf.Clamp01(magnitude / num); if (!(num3 <= 0f)) { float num4 = Mathf.Sin(time * 9f + (float)i * 0.37f); Vector3 val3 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : Vector3.up); ((Vector3)(ref val4))..ctor(Mathf.Sin(time * 6.3f + (float)i * 0.19f), Mathf.Cos(time * 7.7f + (float)i * 0.23f), Mathf.Sin(time * 8.9f + (float)i * 0.31f)); ref Vector3 reference = ref vertices[i]; reference += (val3 * (0.55f + num4 * 0.2f) + val4 * 0.35f) * num2 * num3; } } mesh.vertices = vertices; mesh.RecalculateBounds(); mesh.RecalculateNormals(); MeshCollider component = ((Component)filter).GetComponent<MeshCollider>(); if (!((Object)(object)component != (Object)null)) { return; } try { component.sharedMesh = null; component.sharedMesh = mesh; } catch { } } private static void DeformSkinnedMesh(SkinnedMeshRenderer renderer, Vector3 worldPoint) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //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_0142: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0187: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)renderer == (Object)null || (Object)(object)renderer.sharedMesh == (Object)null) { return; } Mesh sharedMesh; try { if (((Object)renderer.sharedMesh).name.IndexOf("C3b3z", StringComparison.OrdinalIgnoreCase) >= 0) { return; } sharedMesh = renderer.sharedMesh; } catch { return; } Vector3[] vertices = sharedMesh.vertices; if (vertices == null || vertices.Length == 0) { return; } Vector3 val = ((Component)renderer).transform.InverseTransformPoint(worldPoint); Bounds bounds = sharedMesh.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; float num = Mathf.Max(((Vector3)(ref extents)).magnitude * 0.9f, 0.35f); float num2 = Mathf.Max(num * 0.045f, 0.01f); float time = Time.time; Vector3 val3 = default(Vector3); for (int i = 0; i < vertices.Length; i++) { Vector3 val2 = vertices[i] - val; float num3 = 1f - Mathf.Clamp01(((Vector3)(ref val2)).magnitude / num); if (!(num3 <= 0f)) { ((Vector3)(ref val3))..ctor(Mathf.Sin(time * 5.7f + (float)i * 0.13f), Mathf.Cos(time * 8.1f + (float)i * 0.21f), Mathf.Sin(time * 7.2f + (float)i * 0.29f)); Vector3 val4 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : Vector3.up); ref Vector3 reference = ref vertices[i]; reference += (val4 * 0.55f + val3 * 0.35f) * num2 * num3; } } sharedMesh.vertices = vertices; sharedMesh.RecalculateBounds(); sharedMesh.RecalculateNormals(); } } public static class Impact { public static void Corrupt(GameObject target, Vector3 worldPoint, GameObject owner, GameObject projectile) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!CanCorrupt(target, owner, projectile)) { return; } try { Deform(target, worldPoint); Corrupt corrupt = target.GetComponent<Corrupt>(); if ((Object)(object)corrupt == (Object)null) { corrupt = target.AddComponent<Corrupt>(); } corrupt.Initialize(worldPoint); } catch { } } private static bool CanCorrupt(GameObject target, GameObject owner, GameObject projectile) { if ((Object)(object)target == (Object)null) { return false; } if ((Object)(object)target.GetComponentInParent<Cube>() != (Object)null) { return false; } if ((Object)(object)target.GetComponentInParent<CubeProjAttack>() != (Object)null) { return false; } if ((Object)(object)target.GetComponentInParent<CubeAttack>() != (Object)null) { return false; } if ((Object)(object)target.GetComponentInParent<CubeLaser>() != (Object)null) { return false; } if ((Object)(object)target.GetComponentInParent<CubeVisual>() != (Object)null) { return false; } if (CubeRules.IsProjectile(target)) { return false; } if ((Object)(object)owner != (Object)null) { if ((Object)(object)target == (Object)(object)owner) { return false; } if (target.transform.IsChildOf(owner.transform)) { return false; } if (owner.transform.IsChildOf(target.transform)) { return false; } } if ((Object)(object)projectile != (Object)null) { if ((Object)(object)target == (Object)(object)projectile) { return false; } if (target.transform.IsChildOf(projectile.transform)) { return false; } if (projectile.transform.IsChildOf(target.transform)) { return false; } } return true; } public static void Deform(GameObject target, Vector3 worldPoint) { //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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)target == (Object)null)) { try { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Random.Range(-140f, 140f), Random.Range(-180f, 180f), Random.Range(-140f, 140f)); Transform transform = target.transform; transform.rotation *= Quaternion.Euler(val); } catch { } MeshFilter[] componentsInChildren = target.GetComponentsInChildren<MeshFilter>(true); for (int i = 0; i < componentsInChildren.Length; i++) { DeformMesh(componentsInChildren[i], worldPoint); } SkinnedMeshRenderer[] componentsInChildren2 = target.GetComponentsInChildren<SkinnedMeshRenderer>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { DeformSkinnedMesh(componentsInChildren2[j], worldPoint); } } } private static void DeformMesh(MeshFilter filter, Vector3 worldPoint) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) //IL_00cc: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)filter == (Object)null) { return; } Mesh mesh; try { mesh = filter.mesh; } catch { return; } if ((Object)(object)mesh == (Object)null || mesh.vertexCount == 0) { return; } Vector3[] vertices = mesh.vertices; Vector3 val = ((Component)filter).transform.InverseTransformPoint(worldPoint); Bounds bounds = mesh.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; float num = Mathf.Max(((Vector3)(ref extents)).magnitude, 0.5f); float num2 = Mathf.Max(num * 1.75f, 0.8f); for (int i = 0; i < vertices.Length; i++) { Vector3 val2 = vertices[i] - val; float magnitude = ((Vector3)(ref val2)).magnitude; float num3 = 1f - Mathf.Clamp01(magnitude / (num * 1.4f)); float num4 = Mathf.Sin((float)i * 0.73f + Time.time * 4.3f); Vector3 val3 = Random.onUnitSphere * (0.25f + num3 * 0.9f); Vector3 val4 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : Random.onUnitSphere) * 0.45f + val3; if (((Vector3)(ref val4)).sqrMagnitude < 0.0001f) { val4 = Vector3.up; } ((Vector3)(ref val4)).Normalize(); ref Vector3 reference = ref vertices[i]; reference += val4 * num2 * (0.25f + num3 * 2.2f) * (0.8f + num4 * 0.35f); } mesh.vertices = vertices; mesh.RecalculateBounds(); mesh.RecalculateNormals(); MeshCollider component = ((Component)filter).GetComponent<MeshCollider>(); if (!((Object)(object)component != (Object)null)) { return; } try { component.sharedMesh = null; component.sharedMesh = mesh; } catch { } } private static void DeformSkinnedMesh(SkinnedMeshRenderer renderer, Vector3 worldPoint) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) //IL_00c3: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_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) if ((Object)(object)renderer == (Object)null || (Object)(object)renderer.sharedMesh == (Object)null) { return; } try { Mesh val = (renderer.sharedMesh = Object.Instantiate<Mesh>(renderer.sharedMesh)); Vector3[] vertices = val.vertices; Vector3 val3 = ((Component)renderer).transform.InverseTransformPoint(worldPoint); Bounds bounds = val.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; float num = Mathf.Max(((Vector3)(ref extents)).magnitude, 0.5f); float num2 = Mathf.Max(num * 1.55f, 0.75f); for (int i = 0; i < vertices.Length; i++) { Vector3 val4 = vertices[i] - val3; float num3 = 1f - Mathf.Clamp01(((Vector3)(ref val4)).magnitude / (num * 1.35f)); Vector3 val5 = ((((Vector3)(ref val4)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val4)).normalized : Random.onUnitSphere) + Random.onUnitSphere * (0.7f + num3); ((Vector3)(ref val5)).Normalize(); ref Vector3 reference = ref vertices[i]; reference += val5 * num2 * (0.3f + num3 * 2f); } val.vertices = vertices; val.RecalculateBounds(); val.RecalculateNormals(); } catch { } } } public class BlackHole : MonoBehaviour { private Vector3 _baseScale; private Vector3 _basePos; private Quaternion _baseRot; private float _timer; private Vector3 _center; private float _radius; private float _strength; private bool _captured; public void Pulse(Vector3 center, float radius, float strength) { //IL_0043: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) if (!_captured) { _baseScale = ((Component)this).transform.localScale; _basePos = ((Component)this).transform.position; _baseRot = ((Component)this).transform.rotation; _captured = true; } _center = center; _radius = Mathf.Max(0.1f, radius); _strength = Mathf.Max(0.1f, strength); _timer = 0.22f; } private void Update() { //IL_012a: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_008f: 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_00a5: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: 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) if (!_captured) { return; } _timer -= Time.unscaledDeltaTime; if (_timer <= 0f) { ((Component)this).transform.localScale = Vector3.Lerp(((Component)this).transform.localScale, _baseScale, Time.unscaledDeltaTime * 14f); ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, _basePos, Time.unscaledDeltaTime * 14f); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, _baseRot, Time.unscaledDeltaTime * 14f); if (Vector3.Distance(((Component)this).transform.position, _basePos) < 0.01f && Vector3.Distance(((Component)this).transform.localScale, _baseScale) < 0.01f) { ((Component)this).transform.localScale = _baseScale; ((Component)this).transform.position = _basePos; ((Component)this).transform.rotation = _baseRot; _captured = false; } return; } Vector3 val = ((Component)this).transform.position - _center; float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude > _radius)) { float num = 1f - Mathf.Clamp01(magnitude / _radius); Mathf.Sin(Time.time * 42f + (float)((Object)((Component)this).transform).GetInstanceID()); Vector3 val2 = ((magnitude > 0.001f) ? (-((Vector3)(ref val)).normalized * (_strength * num * Time.unscaledDeltaTime * 18f)) : Vector3.zero); Vector3 val3 = Random.insideUnitSphere * (_strength * num * Time.unscaledDeltaTime * 1.8f); Transform transform = ((Component)this).transform; transform.position += val2 + val3; float num2 = 1f + Mathf.Sin(Time.time * 35f) * 0.22f * num; float num3 = 1f + Mathf.Sin(Time.time * 49f + 1.3f) * 0.35f * num; float num4 = 1f + Mathf.Sin(Time.time * 43f + 2.1f) * 0.22f * num; ((Component)this).transform.localScale = Vector3.Scale(_baseScale, new Vector3(num2, num3, num4)); ((Component)this).transform.rotation = _baseRot * Quaternion.Euler(Mathf.Sin(Time.time * 70f) * 18f * num, Mathf.Cos(Time.time * 61f) * 22f * num, Mathf.Sin(Time.time * 83f) * 18f * num); } } private void OnDisable() { //IL_000f: 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_0031: Unknown result type (might be due to invalid IL or missing references) if (_captured) { ((Component)this).transform.localScale = _baseScale; ((Component)this).transform.position = _basePos; ((Component)this).transform.rotation = _baseRot; } } } public sealed class CubeVisual : MonoBehaviour { private readonly List<LineRenderer> lines = new List<LineRenderer>(); private Vector4[] vertices; private int[,] edges; private float phase; private Material lineMaterial; private float visualScale = 1.45f; private float lineWidth = 0.035f; private bool rainbowMode; public void Initialize() { Initialize(visualScale, lineWidth, rainbow: false); } public void Initialize(float scale, float width, bool rainbow) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00a2: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) visualScale = Mathf.Max(0.05f, scale); lineWidth = Mathf.Max(0.005f, width); rainbowMode = rainbow; Shader val = Shader.Find("Unlit/Color") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Standard"); if ((Object)(object)val == (Object)null) { return; } lineMaterial = new Material(val); ((Object)lineMaterial).name = "C3b3z_TesseractRuntime"; if (lineMaterial.HasProperty("_Color")) { lineMaterial.SetColor("_Color", rainbowMode ? Color.white : Color.black); } vertices = (Vector4[])(object)new Vector4[16]; for (int i = 0; i < 16; i++) { vertices[i] = new Vector4(((i & 1) == 0) ? (-1f) : 1f, ((i & 2) == 0) ? (-1f) : 1f, ((i & 4) == 0) ? (-1f) : 1f, ((i & 8) == 0) ? (-1f) : 1f); } List<Vector2Int> list = new List<Vector2Int>(); for (int j = 0; j < 16; j++) { for (int k = 0; k < 4; k++) { int num = j ^ (1 << k); if (j < num) { list.Add(new Vector2Int(j, num)); } } } edges = new int[list.Count, 2]; for (int l = 0; l < list.Count; l++) { int[,] array = edges; int num2 = l; Vector2Int val2 = list[l]; array[num2, 0] = ((Vector2Int)(ref val2)).x; int[,] array2 = edges; int num3 = l; val2 = list[l]; array2[num3, 1] = ((Vector2Int)(ref val2)).y; } for (int m = 0; m < edges.GetLength(0); m++) { GameObject val3 = new GameObject("TesseractEdge_" + m); val3.transform.SetParent(((Component)this).transform, false); LineRenderer val4 = val3.AddComponent<LineRenderer>(); val4.useWorldSpace = false; val4.positionCount = 2; val4.startWidth = lineWidth; val4.endWidth = lineWidth; ((Renderer)val4).material = lineMaterial; val4.startColor = (rainbowMode ? Color.white : Color.black); val4.endColor = (rainbowMode ? Color.white : Color.black); val4.numCapVertices = 2; lines.Add(val4); } } private void Update() { //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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) if (vertices == null || edges == null) { return; } phase += Time.unscaledDeltaTime; float angle = phase * 2.8f; float angle2 = phase * 1.9f; float angle3 = phase * 1.3f; float num = visualScale + Mathf.Sin(phase * 5f) * visualScale * 0.08f; Vector3[] array = (Vector3[])(object)new Vector3[16]; for (int i = 0; i < 16; i++) { Vector4 v = vertices[i]; v = Rotate4D(v, 0, 1, angle); v = Rotate4D(v, 2, 3, angle2); v = Rotate4D(v, 0, 3, angle3); float num2 = 3.2f - v.w; float num3 = 3.2f / Mathf.Max(0.35f, num2); array[i] = new Vector3(v.x, v.y, v.z) * num3 * num; } for (int j = 0; j < lines.Count; j++) { lines[j].SetPosition(0, array[edges[j, 0]]); lines[j].SetPosition(1, array[edges[j, 1]]); float num4 = lineWidth * (0.72f + 0.55f * (0.5f + 0.5f * Mathf.Sin(phase * 8f + (float)j))); lines[j].startWidth = num4; lines[j].endWidth = num4; if (rainbowMode) { Color val = Color.HSVToRGB(Mathf.Repeat(phase * 0.42f + (float)j * 0.035f, 1f), 1f, 1f); lines[j].startColor = val; lines[j].endColor = val; } } } private static Vector4 Rotate4D(Vector4 v, int x, int y, float angle) { //IL_0031: 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_005a: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_00d7: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Cos(angle); float num2 = Mathf.Sin(angle); float num3 = x switch { 2 => v.z, 1 => v.y, 0 => v.x, _ => v.w, }; float num4 = y switch { 2 => v.z, 1 => v.y, 0 => v.x, _ => v.w, }; float num5 = num3 * num - num4 * num2; float num6 = num3 * num2 + num4 * num; switch (x) { case 0: v.x = num5; break; case 1: v.y = num5; break; case 2: v.z = num5; break; default: v.w = num5; break; } switch (y) { case 0: v.x = num6; break; case 1: v.y = num6; break; case 2: v.z = num6; break; default: v.w = num6; break; } return v; } private void OnDestroy() { if ((Object)(object)lineMaterial != (Object)null) { Object.Destroy((Object)(object)lineMaterial); } } } internal sealed class CubeAttack : MonoBehaviour { private Vector3 _direction; private float _speed; private float _life; private float _radius; private GameObject _owner; private GameObject _projectileRoot; private float _cutTimer; private readonly HashSet<int> _hitUnits = new HashSet<int>(); internal void Initialize(Vector3 direction, float speed, float lifetime, float radius, GameObject owner) { //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) _direction = ((