refactor(runtime): extract the live object frame
This commit is contained in:
parent
99a3e819c4
commit
4e4aac2c5a
27 changed files with 1217 additions and 371 deletions
24
src/AcDream.App/World/LiveEntityRuntimeSlot.cs
Normal file
24
src/AcDream.App/World/LiveEntityRuntimeSlot.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
namespace AcDream.App.World;
|
||||
|
||||
internal interface ILiveEntityRuntimeSource
|
||||
{
|
||||
LiveEntityRuntime? Current { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One-time composition bridge for the resource-activation/runtime cycle.
|
||||
/// It owns no identity or entity state; all authority remains in the bound
|
||||
/// <see cref="LiveEntityRuntime"/>.
|
||||
/// </summary>
|
||||
internal sealed class LiveEntityRuntimeSlot : ILiveEntityRuntimeSource
|
||||
{
|
||||
public LiveEntityRuntime? Current { get; private set; }
|
||||
|
||||
public void Bind(LiveEntityRuntime runtime)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(runtime);
|
||||
if (Current is not null)
|
||||
throw new InvalidOperationException("The live entity runtime is already bound.");
|
||||
Current = runtime;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue