Development Merge 2026.04.03 #8

Merged
Syntriax merged 51 commits from development into main 2026-04-03 14:08:02 +02:00
Showing only changes of commit 51534606c8 - Show all commits

View File

@@ -0,0 +1,35 @@
using System.Threading.Tasks;
using static Engine.Core.WaitForTaskYield;
namespace Engine.Core;
public class WaitForTaskYield(Task task, TaskCompletionStatus completionStatus = TaskCompletionStatus.Either) : ICoroutineYield
{
public bool Yield()
{
switch (completionStatus)
{
case TaskCompletionStatus.Successful:
if (task.IsCanceled)
throw new("Task has been canceled.");
if (task.IsFaulted)
throw new("Task has faulted.");
return task.IsCompletedSuccessfully;
case TaskCompletionStatus.Failed:
if (task.IsCompletedSuccessfully)
throw new("Task was completed successfully.");
return task.IsFaulted;
}
return task.IsCompleted;
}
public enum TaskCompletionStatus
{
Either,
Successful,
Failed
}
}