43 lines
935 B
C#
43 lines
935 B
C#
using System;
|
|
using Questionable.Controller.Steps.Common;
|
|
using Questionable.Model;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Controller.Steps.Shared;
|
|
|
|
internal static class WaitAtStart
|
|
{
|
|
internal sealed class Factory : SimpleTaskFactory
|
|
{
|
|
public override ITask? CreateTask(Quest quest, QuestSequence sequence, QuestStep step)
|
|
{
|
|
if (!step.DelaySecondsAtStart.HasValue)
|
|
{
|
|
return null;
|
|
}
|
|
return new WaitDelay(TimeSpan.FromSeconds(step.DelaySecondsAtStart.Value));
|
|
}
|
|
}
|
|
|
|
internal sealed record WaitDelay(TimeSpan Delay) : ITask
|
|
{
|
|
public override string ToString()
|
|
{
|
|
return $"Wait[S](seconds: {Delay.TotalSeconds})";
|
|
}
|
|
}
|
|
|
|
internal sealed class WaitDelayExecutor : AbstractDelayedTaskExecutor<WaitDelay>
|
|
{
|
|
protected override bool StartInternal()
|
|
{
|
|
base.Delay = base.Task.Delay;
|
|
return true;
|
|
}
|
|
|
|
public override bool ShouldInterruptOnDamage()
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|