lyra-wasm-scripting-test/guests/csharp/dotnet-guest-test/LyraApi/Engine/DeltaTime.cs

23 lines
637 B
C#
Raw Permalink Normal View History

2024-11-10 00:13:15 +00:00
using System.Runtime.InteropServices;
using LyraApi;
using LyraApi.Ecs;
using static ExampleWorld.wit.imports.lyra.api.IEcs;
namespace LyraApi.Engine;
[StructLayout(LayoutKind.Sequential)]
public struct DeltaTime : IResource {
public float Seconds;
public static ulong TypeId => 83716348954;
public static object? FromWasmResult(WorldResourceResult result)
{
return result.Tag switch
{
WorldResourceResult.NONE | WorldResourceResult.WASM_RESOURCE => null,
2024-11-10 00:13:15 +00:00
WorldResourceResult.BYTES => MarshalUtils.FromBytes<DeltaTime>(result.AsBytes),
_ => null,
};
}
}