66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
using RuntimeData;
|
|
|
|
namespace Logic.AI
|
|
{
|
|
public enum AIKernelType
|
|
{
|
|
BehaviourTree,
|
|
Director
|
|
}
|
|
|
|
public enum AIKernelUpdateResult
|
|
{
|
|
None,
|
|
ActionReady,
|
|
Finished
|
|
}
|
|
|
|
public static class AIDirectorBatchRuntime
|
|
{
|
|
#if UNITY_EDITOR
|
|
public static bool ForceAllPlayersAi;
|
|
public static bool SkipPresentationWait;
|
|
#else
|
|
public const bool ForceAllPlayersAi = false;
|
|
public const bool SkipPresentationWait = false;
|
|
#endif
|
|
}
|
|
|
|
public readonly struct AIKernelUpdate
|
|
{
|
|
public readonly AIKernelUpdateResult Result;
|
|
public readonly AIActionBase Action;
|
|
|
|
private AIKernelUpdate(AIKernelUpdateResult result, AIActionBase action)
|
|
{
|
|
Result = result;
|
|
Action = action;
|
|
}
|
|
|
|
public static AIKernelUpdate None => new(AIKernelUpdateResult.None, null);
|
|
public static AIKernelUpdate Finished => new(AIKernelUpdateResult.Finished, null);
|
|
|
|
public static AIKernelUpdate ActionReady(AIActionBase action)
|
|
{
|
|
return action == null ? None : new AIKernelUpdate(AIKernelUpdateResult.ActionReady, action);
|
|
}
|
|
}
|
|
|
|
public interface IAIKernel
|
|
{
|
|
AIKernelType KernelType { get; }
|
|
void Initialize(AILogicContext context);
|
|
void StartTurn(MapData mapData, PlayerData playerData);
|
|
AIKernelUpdate Update();
|
|
void FinishTurn();
|
|
}
|
|
|
|
public sealed class AILogicContext
|
|
{
|
|
public AICalculatorData Data;
|
|
public AIActionGenerator Generator;
|
|
public AIActionScoreCalculator ScoreCalculator;
|
|
public AIConfigAsset Config;
|
|
}
|
|
}
|