Track Unity source, scenes, editable assets, licenses, tools and QA evidence. Exclude generated caches, Windows builds and raw runtime logs.
56 lines
2.2 KiB
C#
56 lines
2.2 KiB
C#
using System;
|
|
using System.IO;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace Ironspore.Editor
|
|
{
|
|
public static class RouteSmoke
|
|
{
|
|
[Serializable]
|
|
sealed class Report
|
|
{
|
|
public bool passed; public bool[] cases = new bool[6]; public string note = "Structural route and goal validation. Combat timing is measured separately.";
|
|
}
|
|
public static string Validate()
|
|
{
|
|
var g = GameSession.Active;
|
|
if (!EditorApplication.isPlaying || !g)
|
|
throw new Exception("Play mode required");
|
|
var report = new Report();
|
|
for (int frame = 0; frame < 3; frame++)
|
|
for (int branch = 0; branch < 2; branch++)
|
|
{
|
|
if (g.InField)
|
|
g.EndSortie(true);
|
|
g.SelectedChassis = frame;
|
|
g.StartTrial();
|
|
typeof(GameSession).GetProperty("Trial").SetValue(g, false, null);
|
|
for (int stage = 0; stage < 4; stage++)
|
|
{
|
|
g.CompleteObjective();
|
|
g.NextZone(stage == 1 ? branch : 0);
|
|
}
|
|
if (branch == 0)
|
|
{
|
|
var boss = GameObject.Find("Enemy_99").GetComponent<EnemyUnit>();
|
|
boss.Damage(10000);
|
|
}
|
|
else
|
|
{
|
|
g.World.Escort.transform.position = new Vector3(0, 1.3f, 34);
|
|
g.World.Escort.SendMessage("Update");
|
|
}
|
|
bool reached = g.Run.routeCompleted;
|
|
var ledger = g.Store;
|
|
g.EndSortie(false);
|
|
report.cases[frame * 2 + branch] = reached && !ledger.Data.run.active;
|
|
}
|
|
report.passed = Array.TrueForAll(report.cases, x => x);
|
|
Directory.CreateDirectory("Docs/QA/Prototype/TestResults");
|
|
File.WriteAllText("Docs/QA/Prototype/TestResults/RouteStructure.json", JsonUtility.ToJson(report, true));
|
|
return JsonUtility.ToJson(report);
|
|
}
|
|
}
|
|
}
|