using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Threading.Tasks; using HotUpdate.Gameplay; using HotUpdate.Net; using HotUpdate.UI; using UnityEditor; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; /// Checks that the five formal enemy types replaced the arena stand-ins and animate in a real isolated battle. public static class VerifyFormalEnemies { const string Endpoint = "http://127.0.0.1:18081"; const string Arena = "Assets/Bundles/Scenes/Prototype/PrototypeArena.prefab"; const int Types = 5; /// Matches BuildPrototype.EnemyHeight (run_script compiles each file on its own). const float EnemyHeight = 1.2f; static PrototypeFlow Flow => UnityEngine.Object.FindObjectOfType(); static void Check(bool value, string message) { if (!value) throw new Exception(message); } static T Get(string name) => (T)typeof(PrototypeFlow).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Flow); static void Set(string name, object value) => typeof(PrototypeFlow).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Flow, value); static async Task Until(Func condition, int seconds = 25) { var end = DateTime.UtcNow.AddSeconds(seconds); while (!condition()) { Check(DateTime.UtcNow < end, "Formal enemies timed out: " + Flow?.Page); await Task.Delay(100); } } static void Click(string name) { var b = UnityEngine.Object.FindObjectsOfType