feat(battle-engine): close the AI-simulation subsystem (verbatim)
Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
This commit is contained in:
58
SVSim.BattleEngine/Engine/AITurnControl.cs
Normal file
58
SVSim.BattleEngine/Engine/AITurnControl.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using Cute;
|
||||
using Wizard;
|
||||
|
||||
public class AITurnControl
|
||||
{
|
||||
private DateTime _startTime;
|
||||
|
||||
private bool _isStartTimer;
|
||||
|
||||
public AITurnControl()
|
||||
{
|
||||
_isStartTimer = false;
|
||||
}
|
||||
|
||||
public void StartTurnTimer()
|
||||
{
|
||||
_isStartTimer = true;
|
||||
_startTime = TimeUtil.GetAbsoluteTime();
|
||||
}
|
||||
|
||||
public void SetAndStartTurnTimer(DateTime time)
|
||||
{
|
||||
_isStartTimer = true;
|
||||
_startTime = time;
|
||||
}
|
||||
|
||||
public void Update(IEnemyAI ai)
|
||||
{
|
||||
if (ToolboxGame.RealTimeNetworkAgent != null && ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive && !ai.IsConnectNetwork)
|
||||
{
|
||||
ai.Reconnect();
|
||||
}
|
||||
if (!_isStartTimer || !ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive)
|
||||
{
|
||||
if (_isStartTimer && ai.IsConnectNetwork)
|
||||
{
|
||||
ai.Disconnect();
|
||||
}
|
||||
}
|
||||
else if ((float)NetworkUtility.GetTimeSpanSecond(_startTime.Ticks) >= 90f)
|
||||
{
|
||||
if (ai.IsStackAction)
|
||||
{
|
||||
ai.CleanupStackedAction();
|
||||
}
|
||||
if (!ai.IsStackAction)
|
||||
{
|
||||
ai.TurnEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StopTurnTimer()
|
||||
{
|
||||
_isStartTimer = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user