using System.Collections.Generic; using UnityEngine; using BaseGames.AI; namespace BaseGames.Tests.EditMode.AI { public sealed class FakeSensor : ISensor { public bool Sees; public float LostForValue; public Vector2 Last; public bool Chase; public bool Vision; public bool InChaseZone() => Chase; public bool InVisionZone() => Vision; public bool SeesPlayer() => Sees; public bool InRange(float range) => Sees; // 简化:可见即在范围 public bool LostFor(float seconds) => LostForValue >= seconds; public Vector2 LastKnown => Last; } public sealed class FakeCombat : ICombatant { public string Running; public List Used = new List(); public bool CanUse = true; // 供 CD 门控测试控制(默认可用,向后兼容) public bool UseAbility(string id) { Used.Add(id); Running = id; return true; } public bool IsAbilityRunning(string id = null) => id == null ? Running != null : Running == id; public bool NoAbilityRunning => Running == null; public bool CanUseAbility(string id) => CanUse; public void InterruptAbilities() => Running = null; } public sealed class FakeVitals : IActorVitals { public bool Alive = true; public bool Controllable = true; public float Hp = 1f; public bool IsAlive => Alive; public bool IsControllable => Controllable; public float HpPercent => Hp; public bool HpBelow(float ratio) => Hp < ratio; } public sealed class FakeAiContext : IAiContext { public FakeSensor S = new FakeSensor(); public FakeLocomotion L = new FakeLocomotion(); public FakeCombat C = new FakeCombat(); public FakeVitals V = new FakeVitals(); public Blackboard BB = new Blackboard(); public ISensor Sensor => S; public IEnemyLocomotion Locomotion => L; public ICombatant Combat => C; public IActorVitals Vitals => V; public Blackboard Blackboard => BB; } }