punish v6.8.18.0
This commit is contained in:
commit
e786325cda
322 changed files with 554232 additions and 0 deletions
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
|
||||
namespace Questionable.Controller.Steps.Common;
|
||||
|
||||
internal static class WaitCondition
|
||||
{
|
||||
internal sealed record Task(Func<bool> Predicate, string Description) : ITask
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
return Description;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class WaitConditionExecutor : TaskExecutor<Task>
|
||||
{
|
||||
private DateTime _continueAt = DateTime.MaxValue;
|
||||
|
||||
protected override bool Start()
|
||||
{
|
||||
return !base.Task.Predicate();
|
||||
}
|
||||
|
||||
public override ETaskResult Update()
|
||||
{
|
||||
if (_continueAt == DateTime.MaxValue && base.Task.Predicate())
|
||||
{
|
||||
_continueAt = DateTime.Now.AddSeconds(0.5);
|
||||
}
|
||||
if (!(DateTime.Now >= _continueAt))
|
||||
{
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
|
||||
public override bool ShouldInterruptOnDamage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue