Add utility AI (#806)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com> Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com> Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
24
Content.Server/AI/Operators/Generic/WaitOperator.cs
Normal file
24
Content.Server/AI/Operators/Generic/WaitOperator.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Content.Server.AI.Operators.Generic
|
||||
{
|
||||
public class WaitOperator : AiOperator
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user