Coroutine/Coroutine/WaitSeconds.cs

26 lines
533 B
C#
Raw Normal View History

using System;
2019-06-22 17:24:50 +02:00
namespace Coroutine {
public struct WaitSeconds : IWait {
2019-06-22 17:24:50 +02:00
private double seconds;
public WaitSeconds(double seconds) {
this.seconds = seconds;
}
public WaitType GetWaitType() {
2019-06-22 17:24:50 +02:00
return WaitType.Tick;
}
public bool Tick(double deltaSeconds) {
2019-06-22 17:24:50 +02:00
this.seconds -= deltaSeconds;
return this.seconds <= 0;
}
public bool OnEvent(Event evt) {
throw new NotSupportedException();
}
2019-06-22 17:24:50 +02:00
}
}