2020-06-18 22:52:44 +10:00
|
|
|
namespace Content.Server.AI.Operators.Generic
|
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class WaitOperator : AiOperator
|
2020-06-18 22:52:44 +10:00
|
|
|
{
|
|
|
|
|
private readonly float _waitTime;
|
|
|
|
|
private float _accumulatedTime = 0.0f;
|
|
|
|
|
|
|
|
|
|
public WaitOperator(float waitTime)
|
|
|
|
|
{
|
|
|
|
|
_waitTime = waitTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Outcome Execute(float frameTime)
|
|
|
|
|
{
|
|
|
|
|
if (_accumulatedTime < _waitTime)
|
|
|
|
|
{
|
|
|
|
|
_accumulatedTime += frameTime;
|
|
|
|
|
return Outcome.Continuing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Outcome.Success;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|