![]() |
VOOZH | about |
dotnet add package SimulationTree.Simulation.Core --version 0.3.9
NuGet\Install-Package SimulationTree.Simulation.Core -Version 0.3.9
<PackageReference Include="SimulationTree.Simulation.Core" Version="0.3.9" />
<PackageVersion Include="SimulationTree.Simulation.Core" Version="0.3.9" />Directory.Packages.props
<PackageReference Include="SimulationTree.Simulation.Core" />Project file
paket add SimulationTree.Simulation.Core --version 0.3.9
#r "nuget: SimulationTree.Simulation.Core, 0.3.9"
#:package SimulationTree.Simulation.Core@0.3.9
#addin nuget:?package=SimulationTree.Simulation.Core&version=0.3.9Install as a Cake Addin
#tool nuget:?package=SimulationTree.Simulation.Core&version=0.3.9Install as a Cake Tool
Library providing a way to broadcast messages to added listeners.
Simulators contain and update systems:
public static void Main()
{
using Simulator simulator = new();
simulator.Add(new ProgramSystems());
// do work
simulator.Remove<ProgramSystems>();
}
public class ProgramSystems : IDisposable
{
public ProgramSystems()
{
//before addition
}
public void Dispose()
{
//after removal
}
}
A system that is partial, and implementing the IListener<T> interface will
allow it to receive messages broadcast by the simulator:
simulator.Broadcast(32f);
simulator.Broadcast(32f);
simulator.Broadcast(32f);
public partial class ListenerSystem : IListener<float>
{
void IListener<float>.Receive(ref float message)
{
}
}
Messages can also be broadcast by reference, allowing systems to modify them, and use it to communicate between different projects:
LoadRequest request = new();
simulator.Broadcast(ref request);
Assert.That(request.loaded, Is.True);
public partial class LoadSystem : IListener<LoadRequest>
{
void IListener<float>.Receive(ref LoadRequest message)
{
message.loaded = true;
}
}
public struct LoadRequest
{
public bool loaded;
}
Another way to have listeners and broadcasting setup, is using the included GlobalSimulator type.
This approach is slimmer than with the Simulator, at the cost of the listeners being global to the entire
runtime.
public class Program
{
public static void Main()
{
GlobalSimulatorLoader.Load();
GlobalSimulator.Broadcast(32f);
GlobalSimulator.Broadcast(32f);
GlobalSimulator.Broadcast(32f);
}
}
public static class Systems
{
[Listener<float>]
public static void Update(ref float message)
{
}
}
This library is created for composing behaviour of programs using systems, ideally created by separate isolated projects.
Contributions to this goal are welcome.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on SimulationTree.Simulation.Core:
| Package | Downloads |
|---|---|
|
SimulationTree.Simulation
Assists programming with value types |
|
|
SimulationTree.Rendering.Systems
Package Description |
|
|
SimulationTree.Meshes.NineSliced
Package Description |
|
|
SimulationTree.Materials.Systems
Package Description |
|
|
SimulationTree.Textures.Systems
Package Description |
This package is not used by any popular GitHub repositories.