using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UltraScape.Enemies;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UltraScape")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3b894b052d666106073bff2ed30df14cbb9871ab")]
[assembly: AssemblyProduct("UltraScape")]
[assembly: AssemblyTitle("UltraScape")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace UltraScape
{
internal static class Assetloader
{
internal static AssetBundle Bundle = AssetBundle.LoadFromFile(Plugin.ModDir + "/ultrascape");
internal static SpawnableObject[] SpawnableEnemies = Bundle.LoadAllAssets<SpawnableObject>();
internal static EnemyScriptableObject[] EnemyScriptableObjects = Bundle.LoadAllAssets<EnemyScriptableObject>();
internal static GameObject enemyManager = Bundle.LoadAsset<GameObject>("EnemyManager");
}
[HarmonyPatch]
public static class Patches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(EndlessGrid), "NextWave")]
public static void WaveChangeTracker(ref EndlessGrid __instance)
{
if ((MonoSingleton<EnemyManager>.Instance?.endlessEnabled).Value)
{
MonoSingleton<EnemyManager>.Instance?.WaveChange(__instance.currentWave);
}
Plugin.Log($"Wave Change to {__instance.currentWave} detected.");
}
[HarmonyPostfix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static void ScoresSubmission(ref bool __result)
{
if (SceneHelper.CurrentScene == "Endless" && (MonoSingleton<EnemyManager>.Instance?.endlessEnabled).Value)
{
__result = false;
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "com.blaixenu.ultrascape";
public const string PLUGIN_NAME = "ULTRASCAPE";
public const string PLUGIN_VERSION = "0.1.0";
}
[BepInPlugin("com.blaixenu.ultrascape", "ULTRASCAPE", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
private static bool hasAddedEnemies = false;
private static readonly bool DEBUG_MODE = true;
internal static ManualLogSource Logger { get; private set; } = null;
public static string ModDir => Path.GetDirectoryName(typeof(Plugin).Assembly.Location);
private void Awake()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin com.blaixenu.ultrascape is loaded!");
((Object)((Component)this).gameObject).hideFlags = (HideFlags)4;
Harmony val = new Harmony("com.blaixenu.ultrascape");
val.PatchAll();
Log("Harmony patching completed.");
Log("ModDir: " + ModDir);
Log("Assets found in bundle:");
Object[] array = Assetloader.Bundle.LoadAllAssets();
foreach (Object val2 in array)
{
Log(val2.name);
}
SceneManager.sceneLoaded += OnSceneLoad;
}
private void AddEnemies()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
hasAddedEnemies = true;
Log("Starting adding enemies to bestiary");
Log("Loading bestiary");
SpawnableObjectsDatabase val = Addressables.LoadAssetAsync<SpawnableObjectsDatabase>((object)"Assets/Data/Bestiary Database.asset").WaitForCompletion();
Log("Loading bestiary success");
Log("Adding enemies to bestiary");
val.enemies = val.enemies.ToArray().Concat(Assetloader.SpawnableEnemies.ToArray()).ToArray();
Log("Adding enemies to bestiary success");
Log("starting adding enemies to sandbox");
Log("Loading sandbox");
SpawnableObjectsDatabase val2 = Addressables.LoadAssetAsync<SpawnableObjectsDatabase>((object)"Assets/Data/Sandbox/Spawnable Objects Database.asset").WaitForCompletion();
Log("Loading sandbox success");
Log("Adding enemies to sandbox");
val2.enemies = val2.enemies.ToArray().Concat(Assetloader.SpawnableEnemies.ToArray()).ToArray();
Log("Adding enemies to sandbox success");
}
private void OnSceneLoad(Scene scene, LoadSceneMode mode)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
if (!hasAddedEnemies)
{
AddEnemies();
}
GameObject val = new GameObject("ULTRASCAPE");
EnemyManager component = Object.Instantiate<GameObject>(Assetloader.enemyManager, val.transform).GetComponent<EnemyManager>();
EnemyScriptableObject[] enemyScriptableObjects = Assetloader.EnemyScriptableObjects;
foreach (EnemyScriptableObject enemyScriptableObject in enemyScriptableObjects)
{
component.enemies[enemyScriptableObject] = new EnemySceneInfo();
Log(((Object)enemyScriptableObject).name + " registered to EnemyManager");
}
}
public static void Log<T>(T log)
{
if (DEBUG_MODE)
{
Logger.LogInfo((object)log);
}
}
public static void Log<T>(T[] log)
{
if (DEBUG_MODE)
{
foreach (T val in log)
{
Logger.LogInfo((object)val);
}
}
}
}
}
namespace UltraScape.Misc
{
public class ShrinkAndFadeSprite : MonoBehaviour
{
public float shrinkSpeed;
public float fadeSpeed;
public bool destroyOnComplete = true;
[HideInInspector]
public bool completed = false;
private Vector3 originalScale;
private float originalAlpha;
private SpriteRenderer spr = null;
private void Awake()
{
//IL_0032: 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_004d: Unknown result type (might be due to invalid IL or missing references)
spr = ((Component)this).GetComponent<SpriteRenderer>();
if ((Object)(object)spr == (Object)null)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
originalAlpha = spr.color.a;
originalScale = ((Component)this).transform.localScale;
shrinkSpeed = Mathf.Clamp(shrinkSpeed, 0f, 100f);
fadeSpeed = Mathf.Clamp(fadeSpeed, 0f, 100f);
}
private void Update()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
if (shrinkSpeed == 0f && fadeSpeed == 0f)
{
return;
}
if (completed)
{
Destroy();
return;
}
if (shrinkSpeed > 0f)
{
Transform transform = ((Component)this).transform;
transform.localScale -= originalScale * shrinkSpeed * Time.deltaTime;
if (originalScale.x / 100f >= ((Component)this).transform.localScale.x)
{
completed = true;
}
}
if (fadeSpeed > 0f)
{
float num = spr.color.a - originalAlpha * fadeSpeed * Time.deltaTime;
spr.color = new Color(spr.color.r, spr.color.g, spr.color.b, num);
if (spr.color.a <= 0f)
{
completed = true;
}
}
}
private void Destroy()
{
if (destroyOnComplete)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
}
namespace UltraScape.Enemies
{
public class AerialBody : MonoBehaviour
{
[Header("Drift")]
public bool drift = true;
public float driftRate = 0f;
[Space(5f)]
public bool targetPlayer = true;
public Transform target = null;
[Space(10f)]
[Header("Displacement")]
public float displacementDistance;
public float displacementTime;
public AnimationCurve displacementGraph = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
[Space(5f)]
public UnityEvent onDisplacementStart = null;
public UnityEvent onDisplacementEnd = null;
[HideInInspector]
public bool displacing = false;
public Transform GetTarget
{
get
{
if (targetPlayer)
{
return ((Component)MonoSingleton<NewMovement>.Instance).transform;
}
if ((Object)(object)target != (Object)null)
{
return target;
}
return null;
}
}
private void Awake()
{
displacing = false;
}
private void Update()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance) && drift && driftRate != 0f && !displacing)
{
Drift(GetTarget.position, driftRate * Time.deltaTime * Time.timeScale);
}
}
private void Drift(Vector3 targetPosition, float magnitude)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)this).transform;
transform.position += Quaternion.LookRotation(targetPosition - ((Component)this).transform.position) * Vector3.forward * magnitude;
}
public void Displace(Vector3 destination)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
((MonoBehaviour)this).StopCoroutine("DisplaceRoutine");
((MonoBehaviour)this).StartCoroutine(DisplaceRoutine(destination, displacementTime));
}
private IEnumerator DisplaceRoutine(Vector3 destination, float duration)
{
//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)
displacing = true;
float totalTime = 0f;
Vector3 startPos = ((Component)this).transform.position;
Vector3 travelVector = destination - startPos;
onDisplacementStart.Invoke();
for (; totalTime < duration; totalTime += Time.fixedDeltaTime)
{
float timeNormalized = totalTime / duration;
((Component)this).transform.position = startPos + displacementGraph.Evaluate(timeNormalized) * travelVector;
yield return (object)new WaitForSeconds(Time.fixedDeltaTime);
}
displacing = false;
onDisplacementEnd.Invoke();
}
}
public class Baby : Enemy
{
public enum BabyState
{
Idle,
LockOn,
Charge
}
[Header("Asset References")]
public GameObject lockOnSound = null;
public GameObject chargeSound = null;
[Space(5f)]
public GameObject trailObject = null;
public GameObject lockOnFlashObject = null;
[Space(5f)]
public GameObject normalEffects = null;
public GameObject chargeEffects = null;
private GameObject lockOnFlashInstance = null;
private Animator animator = null;
private Enemy enemy = null;
[Space(10f)]
public AnimationCurve chargeCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
[Space(10f)]
[Header("Cooldowns")]
public float chargeDistance = 50f;
public float chargeDuration = 1f;
private float chargeTimer;
public float lockOnDuration = 0.75f;
private float lockOnTimer;
public float idleDuration = 0.5f;
private float idleTimer;
private Vector3 chargeStartPos;
private Vector3 attackVector;
private BabyTrail trailInstance = null;
public BabyState State { get; private set; }
protected override void Awake()
{
base.Awake();
animator = ((Component)this).GetComponent<Animator>();
enemy = ((Component)this).GetComponent<Enemy>();
ResetCooldowns();
EnterIdle();
}
protected override void Start()
{
base.Start();
enemy.parryBox.enabled = false;
normalEffects.SetActive(true);
chargeEffects.SetActive(false);
}
private void Update()
{
//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_017e: 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_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance))
{
EnterIdle();
return;
}
switch (State)
{
case BabyState.Idle:
{
AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Idle") && idleTimer >= idleDuration)
{
EnterLockOn();
}
idleTimer += Time.deltaTime * Time.timeScale;
break;
}
case BabyState.LockOn:
if (lockOnTimer >= lockOnDuration)
{
EnterCharge();
}
lockOnTimer += Time.deltaTime * Time.timeScale;
if (lockOnTimer > 2f * Time.deltaTime && Object.op_Implicit((Object)(object)lockOnFlashInstance))
{
lockOnFlashInstance.transform.localPosition = new Vector3(0f, 0f, -0.01f);
}
break;
case BabyState.Charge:
{
if (chargeTimer >= chargeDuration)
{
EnterIdle();
}
chargeTimer += Time.deltaTime * Time.timeScale;
float num = chargeCurve.Evaluate(chargeTimer / chargeDuration);
((Component)this).transform.position = chargeStartPos + attackVector * num;
break;
}
default:
SetState(BabyState.Idle);
ResetCooldowns();
break;
}
}
public void SyncState()
{
animator.SetInteger("BabyState", (int)State);
}
private void SetState(BabyState _state)
{
State = _state;
SyncState();
}
public void EnterLockOn()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_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_004d: 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_0054: 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_005c: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
SetState(BabyState.LockOn);
Object.Instantiate<GameObject>(lockOnSound, ((Component)this).gameObject.transform);
lockOnTimer = 0f;
chargeStartPos = ((Component)this).transform.position;
Vector3 position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
Vector3 val = position - chargeStartPos;
attackVector = ((Vector3)(ref val)).normalized * chargeDistance;
trailInstance = PrepareTrail(chargeStartPos, chargeStartPos + attackVector);
lockOnFlashInstance = Object.Instantiate<GameObject>(lockOnFlashObject, ((Component)this).gameObject.transform);
lockOnFlashInstance.transform.localPosition = new Vector3(0f, 0f, 0.1f);
}
public void EnterCharge()
{
SetState(BabyState.Charge);
Object.Instantiate<GameObject>(chargeSound, ((Component)this).gameObject.transform);
chargeTimer = 0f;
trailInstance?.StartFade();
enemy.parryBox.enabled = true;
normalEffects.SetActive(false);
chargeEffects.SetActive(true);
}
public void EnterIdle()
{
SetState(BabyState.Idle);
idleTimer = 0f;
enemy.parryBox.enabled = false;
normalEffects.SetActive(true);
chargeEffects.SetActive(false);
}
public void ResetCooldowns()
{
chargeTimer = 0f;
idleTimer = 0f;
lockOnTimer = 0f;
}
private BabyTrail PrepareTrail(Vector3 startPos, Vector3 endPos)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(trailObject);
LineRenderer component = val.GetComponent<LineRenderer>();
component.SetPosition(0, startPos);
component.SetPosition(1, endPos);
return val.GetComponent<BabyTrail>();
}
}
public class BabyTrail : MonoBehaviour
{
private LineRenderer lr = null;
[Tooltip("1 = one tile scrolled per unit time. Can be negative.")]
public float scrollSpeed = 8f;
public float scrollDecaySpeed = 0.25f;
public float scrollSpeedWhenFading = 0.5f;
[Tooltip("1 = opacity decreased from 1.0 to 0.0 in unit time.")]
public float fadeSpeed = 1f;
public float shrinkSpeed = 1f;
private float originalScrollSpeed;
private float originalWidth;
private Color originalColor;
[HideInInspector]
public bool fading;
private MaterialPropertyBlock propBlock = null;
private static readonly int tilingPropertyID = Shader.PropertyToID("_MainTex_ST");
private static readonly int colorPropertyID = Shader.PropertyToID("_Color");
private Color alphaToSubtract;
private Vector4 tilingOffsetToAdd = default(Vector4);
public void StartFade()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
fading = true;
originalWidth = lr.startWidth;
originalColor = ((Renderer)lr).sharedMaterial.GetColor(colorPropertyID);
originalScrollSpeed = scrollSpeed;
}
private void Awake()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
lr = ((Component)this).GetComponent<LineRenderer>();
propBlock = new MaterialPropertyBlock();
alphaToSubtract = new Color(0f, 0f, 0f, 0f);
tilingOffsetToAdd = ((Renderer)lr).sharedMaterial.GetVector(tilingPropertyID);
}
private void Update()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00a6: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: 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_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)lr))
{
if (lr.startWidth <= 0f)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
((Renderer)lr).GetPropertyBlock(propBlock);
tilingOffsetToAdd += new Vector4(0f, 0f, (0f - scrollSpeed) * (fading ? scrollSpeedWhenFading : 1f) * Time.deltaTime, 0f);
propBlock.SetVector(tilingPropertyID, tilingOffsetToAdd);
scrollSpeed = Mathf.MoveTowards(scrollSpeed, 0f, originalScrollSpeed * scrollDecaySpeed * Time.deltaTime);
if (fading)
{
LineRenderer obj = lr;
obj.startWidth -= shrinkSpeed * originalWidth * Time.deltaTime;
alphaToSubtract += new Color(0f, 0f, 0f, fadeSpeed * Time.deltaTime);
Color val = originalColor;
propBlock.SetColor(colorPropertyID, val - alphaToSubtract);
}
((Renderer)lr).SetPropertyBlock(propBlock);
}
}
}
public class Enemy : MonoBehaviour
{
public EnemyScriptableObject enemyScriptableObject = null;
[Space(10f)]
[Header("Triggers")]
public Collider hurtBox = null;
public Collider parryBox = null;
private ParryReceiver parryRec = null;
[Space(10f)]
[Header("Events")]
public UnityEvent onCreate = null;
public UnityEvent onDestroy = null;
private EnemyManager eman => MonoSingleton<EnemyManager>.Instance;
protected virtual void Awake()
{
if (Object.op_Implicit((Object)(object)parryBox))
{
parryRec = ((Component)parryBox).GetComponent<ParryReceiver>();
}
((Component)this).gameObject.transform.SetParent(((Component)eman).transform);
}
protected virtual void Start()
{
MonoSingleton<EnemyManager>.Instance?.AddEnemy(((Component)this).gameObject, enemyScriptableObject);
onCreate.Invoke();
}
protected virtual void OnDestroy()
{
MonoSingleton<EnemyManager>.Instance?.RemoveEnemy(((Component)this).gameObject, enemyScriptableObject);
onDestroy.Invoke();
}
}
[ConfigureSingleton(/*Could not decode attribute arguments.*/)]
public class EnemyManager : MonoSingleton<EnemyManager>
{
public bool endlessEnabled;
public int spawnQuantity = 2;
public int spawnGap = 5;
public float spawnDelayIncrement = 1f;
private int timesSpawned = 0;
private Queue<EnemyScriptableObject> enemyQueue = new Queue<EnemyScriptableObject>();
public Dictionary<EnemyScriptableObject, EnemySceneInfo> enemies = new Dictionary<EnemyScriptableObject, EnemySceneInfo>();
private bool InEndless => SceneHelper.CurrentScene == "Endless";
public static int NSDiff
{
get
{
PrefsManager instance = MonoSingleton<PrefsManager>.Instance;
int? num = ((instance != null) ? new int?(instance.GetInt("difficulty", 0)) : ((int?)null));
if (1 == 0)
{
}
if (!num.HasValue)
{
goto IL_004c;
}
int valueOrDefault = num.GetValueOrDefault();
int result;
if (valueOrDefault <= 3)
{
if (valueOrDefault <= 1)
{
goto IL_004c;
}
result = 1;
}
else
{
result = 2;
}
goto IL_0050;
IL_0050:
if (1 == 0)
{
}
return result;
IL_004c:
result = 0;
goto IL_0050;
}
}
private void Awake()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (InEndless)
{
timesSpawned = 0;
}
((Component)this).gameObject.transform.position = Vector3.zero;
}
private void Start()
{
foreach (KeyValuePair<EnemyScriptableObject, EnemySceneInfo> enemy in enemies)
{
Plugin.Log(((Object)enemy.Key).name ?? "");
Plugin.Log($"{enemy.Key.prefab}");
DifficultySettings<int> startingWaves = enemy.Key.startingWaves;
Plugin.Log($"{startingWaves.GetValue(0)}, {startingWaves.GetValue(1)}, {startingWaves.GetValue(2)}");
DifficultySettings<int> maxStacks = enemy.Key.maxStacks;
Plugin.Log($"{maxStacks.GetValue(0)}, {maxStacks.GetValue(1)}, {maxStacks.GetValue(2)}");
Plugin.Log("");
}
}
internal void WaveChange(int newWave)
{
if (timesSpawned == 0)
{
Plugin.Log("Skipped waves detected, attempting to queue.");
for (int i = spawnGap; i < newWave - 1; i += spawnGap)
{
QueueBatch(i);
}
}
if (newWave % spawnGap == 0)
{
QueueBatch(newWave);
}
((MonoBehaviour)this).StartCoroutine(SpawnQueue());
}
private void QueueBatch(int waveForQueue)
{
Plugin.Log($"Queueing for Wave {waveForQueue}");
for (int i = 0; i < spawnQuantity; i++)
{
List<EnemyScriptableObject> list = new List<EnemyScriptableObject>();
foreach (KeyValuePair<EnemyScriptableObject, EnemySceneInfo> enemy in enemies)
{
int value = enemy.Key.startingWaves.GetValue(NSDiff);
int value2 = enemy.Key.maxStacks.GetValue(NSDiff);
int count = enemy.Value.activeInstances.Count;
int spawnBuffer = enemy.Value.spawnBuffer;
Plugin.Log($"startingWave: {value}");
Plugin.Log($"maxStack: {value2}");
Plugin.Log($"activeInstances: {count}");
Plugin.Log($"spawnBuffer: {spawnBuffer}");
if (waveForQueue >= value && count + spawnBuffer < value2)
{
list.Add(enemy.Key);
enemies[enemy.Key].spawnBuffer++;
Plugin.Log(((Object)enemy.Key).name + " added to enemy pool.");
}
}
if (list.Count > 0)
{
Plugin.Log($"enemy pool consists of {list.Count} elements");
int index = Random.Range(0, list.Count);
enemyQueue.Enqueue(list[index]);
}
}
timesSpawned++;
}
private IEnumerator SpawnQueue()
{
Plugin.Log("Spawning queue");
while (enemyQueue.Count > 0)
{
EnemyScriptableObject nextEnemy = enemyQueue.Dequeue();
SpawnEnemy(nextEnemy);
enemies[nextEnemy].spawnBuffer--;
yield return (object)new WaitForSeconds(spawnDelayIncrement);
}
}
private void SpawnEnemy(EnemyScriptableObject enemyScriptableObject)
{
Plugin.Log("Spawning enemy: " + ((Object)enemyScriptableObject).name);
GameObject val = Object.Instantiate<GameObject>(enemyScriptableObject.prefab, ((Component)this).gameObject.transform);
ICustomEndlessSpawnable customEndlessSpawnable = default(ICustomEndlessSpawnable);
if (endlessEnabled && InEndless && val.TryGetComponent<ICustomEndlessSpawnable>(ref customEndlessSpawnable))
{
customEndlessSpawnable.AfterSpawn();
}
}
public void AddEnemy(GameObject self, EnemyScriptableObject enemyScriptableObject)
{
enemies[enemyScriptableObject].activeInstances.Add(self);
}
public void RemoveEnemy(GameObject self, EnemyScriptableObject enemyScriptableObject)
{
for (int i = 0; i < enemies[enemyScriptableObject].activeInstances.Count; i++)
{
if ((Object)(object)enemies[enemyScriptableObject].activeInstances[i] == (Object)(object)self)
{
enemies[enemyScriptableObject].activeInstances.RemoveAt(i);
break;
}
}
}
}
public class EnemySceneInfo
{
public List<GameObject> activeInstances = new List<GameObject>();
internal int spawnBuffer = 0;
}
[CreateAssetMenu(fileName = "EnemyScriptableObject", menuName = "ULTRASCAPE/EnemyScriptableObject")]
public class EnemyScriptableObject : ScriptableObject
{
public string enemyName = null;
public GameObject prefab = null;
public DifficultySettings<int> startingWaves;
public DifficultySettings<int> maxStacks;
}
[Serializable]
public struct DifficultySettings<T>
{
public T casual;
public T standard;
public T extreme;
public readonly T GetValue(int difficulty)
{
if (1 == 0)
{
}
T result = difficulty switch
{
0 => casual,
1 => standard,
2 => extreme,
_ => standard,
};
if (1 == 0)
{
}
return result;
}
}
public enum ICBMState
{
cooldown,
tracking,
falling
}
public class ICBM : MonoBehaviour
{
public GameObject fullSound = null;
[Space(5f)]
public float trackingDuration;
[Tooltip("ONLY the interval of the lockin to the explosion.")]
public float fallingDuration;
[Space(10f)]
[Header("Indicator")]
[Tooltip("In Degrees.")]
public float rotationSpeed;
public float scaleGrowAmount = 1.25f;
[Space(10f)]
[Header("The Actual ICBM")]
public GameObject missile = null;
public GameObject missileInstance = null;
public GameObject explosion = null;
public float startHeight;
[Space(20f)]
public float cooldown;
private float timeSpentCooldown;
private float timeSpentTracking;
private float timeSpentFalling;
private Vector3 actualScale;
private Color actualColor;
private MaterialPropertyBlock propBlock = null;
private SpriteRenderer spr = null;
private static readonly int colorPropertyID = Shader.PropertyToID("_Color");
[HideInInspector]
public ICBMState State { get; private set; }
private void Awake()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
spr = ((Component)this).GetComponent<SpriteRenderer>();
propBlock = new MaterialPropertyBlock();
actualScale = ((Component)this).transform.localScale;
actualColor = ((Renderer)spr).sharedMaterial.GetColor(colorPropertyID);
}
private void Start()
{
StateChange(ICBMState.cooldown);
timeSpentCooldown = 0f - cooldown;
}
private void Update()
{
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
switch (State)
{
case ICBMState.cooldown:
if (timeSpentCooldown > cooldown)
{
StateChange(ICBMState.tracking);
Object.Instantiate<GameObject>(fullSound, ((Component)this).transform);
}
timeSpentCooldown += Time.deltaTime * Time.timeScale;
break;
case ICBMState.tracking:
{
if (timeSpentTracking > trackingDuration)
{
StateChange(ICBMState.falling);
missileInstance = Object.Instantiate<GameObject>(missile);
missileInstance.transform.position = ((Component)this).transform.position + new Vector3(0f, startHeight, 0f);
}
timeSpentTracking += Time.deltaTime * Time.timeScale;
((Component)this).transform.Rotate(Vector3.up, rotationSpeed / 360f * Time.timeScale);
float num = 0.5f;
if (timeSpentTracking > num)
{
((Renderer)spr).GetPropertyBlock(propBlock);
propBlock.SetColor(colorPropertyID, new Color(actualColor.r, actualColor.g, actualColor.b, timeSpentTracking / num));
((Renderer)spr).SetPropertyBlock(propBlock);
((Component)this).transform.localScale = actualScale * (1f + (num - timeSpentTracking));
}
((Component)this).transform.position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
break;
}
case ICBMState.falling:
{
if (timeSpentFalling > fallingDuration)
{
StateChange(ICBMState.cooldown);
missileInstance = null;
}
timeSpentFalling += Time.deltaTime * Time.timeScale;
GameObject obj = missileInstance;
if (obj != null)
{
obj.transform.Translate(new Vector3(0f, (0f - startHeight) / fallingDuration * Time.deltaTime * Time.timeScale, 0f));
}
break;
}
}
}
private void ResetTimers()
{
timeSpentFalling = 0f;
timeSpentCooldown = 0f;
timeSpentTracking = 0f;
}
private void StateChange(ICBMState newState)
{
ResetTimers();
State = newState;
}
}
public interface ICustomEndlessSpawnable
{
void AfterSpawn();
}
public class Mart : MonoBehaviour, ICustomEndlessSpawnable
{
public Collider mergeCollider = null;
private void Awake()
{
mergeCollider = ((Component)this).GetComponentInChildren<Collider>();
}
public void AfterSpawn()
{
}
}
public class Modifiers
{
}
public class Operator : Enemy
{
public enum OperatorState
{
green,
yellow,
red
}
public OperatorState State { get; private set; }
}
public struct PlayerModelData
{
public Vector3 worldPos;
public Quaternion lookDirection;
}
public class Telefragger : Enemy
{
public float cooldownTime = 6.1f;
public float attackTime = 0.9f;
[Tooltip("Parented to player.")]
public GameObject attackEffect = null;
private GameObject? attackEffectInstance = null;
public GameObject teleportEffect = null;
public float minimumTeleportDistance = 20f;
private bool attacking = false;
private float cooldownTimer = 0f;
private float attackTimer = 0f;
private List<Vector3> velocityVectors = new List<Vector3>();
protected override void Start()
{
base.Start();
attacking = false;
}
private void Update()
{
if (!Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance))
{
ResetTimers();
}
else if (attacking)
{
if (attackTimer >= attackTime)
{
Teleport();
}
attackTimer += Time.deltaTime * Time.timeScale;
}
else
{
if (cooldownTimer >= cooldownTime)
{
StartAttack();
}
cooldownTimer += Time.deltaTime * Time.timeScale;
}
}
private void FixedUpdate()
{
//IL_003f: 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)
if (Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance) && attacking)
{
List<Vector3> list = velocityVectors;
NewMovement instance = MonoSingleton<NewMovement>.Instance;
list.Add(((instance != null) ? new Vector3?(instance.rb.velocity) : ((Vector3?)null)).Value);
}
}
public void Teleport()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_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_008f: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00db: 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)
ResetTimers();
attacking = false;
Vector3 val = default(Vector3);
foreach (Vector3 velocityVector in velocityVectors)
{
val += velocityVector;
}
Vector3 val2 = val / (float)velocityVectors.Count();
Vector3 val3 = ((Vector3)(ref val2)).normalized - new Vector3(0f, ((Vector3)(ref val2)).normalized.y, 0f);
Vector3 val4 = val3 * Mathf.Clamp(((Vector3)(ref val3)).magnitude, minimumTeleportDistance, minimumTeleportDistance * 2f);
Transform transform = ((Component)this).transform;
NewMovement instance = MonoSingleton<NewMovement>.Instance;
transform.position = ((instance != null) ? new Vector3?(((Component)instance).transform.position + val4) : ((Vector3?)null)).Value;
velocityVectors = new List<Vector3>();
if (Object.op_Implicit((Object)(object)teleportEffect))
{
Object.Instantiate<GameObject>(teleportEffect, ((Component)this).transform);
}
GameObject? obj = attackEffectInstance;
if (obj != null)
{
obj.transform.SetParent(((Component)this).transform);
}
}
public void StartAttack()
{
ResetTimers();
attacking = true;
if (Object.op_Implicit((Object)(object)attackEffect))
{
GameObject obj = attackEffect;
NewMovement instance = MonoSingleton<NewMovement>.Instance;
attackEffectInstance = Object.Instantiate<GameObject>(obj, (instance != null) ? ((Component)instance).transform : null);
}
}
private void ResetTimers()
{
cooldownTimer = 0f;
attackTimer = 0f;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}