namespace Content.Server.AI.Operators { public abstract class AiOperator { public bool HasStartup { get; private set; } public bool HasShutdown { get; private set; } /// /// Called once when the NPC starts this action /// /// true if it hasn't started up previously public virtual bool Startup() { // If we've already startup then no point continuing // This signals to the override that it's already startup // Should probably throw but it made some code elsewhere marginally easier if (HasStartup) return false; HasStartup = true; return true; } /// /// Called once when the NPC is done with this action if the outcome is successful or fails. /// public virtual bool Shutdown(Outcome outcome) { if (HasShutdown) return false; HasShutdown = true; return true; } /// /// Called every tick for the AI /// /// /// public abstract Outcome Execute(float frameTime); } public enum Outcome { Success, Continuing, Failed, } }