Class ScriptSystem
- Namespace
- Stride.Engine.Processors
- Assembly
- Stride.Engine.dll
The script system handles scripts scheduling in a game.
public sealed class ScriptSystem : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
- Inheritance
-
objectScriptSystem
- Implements
- Inherited Members
- Extension Methods
Constructors
ScriptSystem(IServiceRegistry)
Initializes a new instance of the GameSystemBase class.
public ScriptSystem(IServiceRegistry registry)
Parameters
registryIServiceRegistryThe registry.
Remarks
The GameSystem is expecting the following services to be registered: IGame and ContentManager.
Properties
Scheduler
Gets the scheduler.
public Scheduler Scheduler { get; }
Property Value
- Scheduler
The scheduler.
Methods
Add(ScriptComponent)
Add the provided script to the script system.
public void Add(ScriptComponent script)
Parameters
scriptScriptComponentThe script to add
AddTask(Func<Task>, long)
Adds the specified micro thread function.
public MicroThread AddTask(Func<Task> microThreadFunction, long priority = 0)
Parameters
Returns
- MicroThread
MicroThread.
Destroy()
Disposes of object resources.
protected override void Destroy()
LiveReload(ScriptComponent, ScriptComponent)
Called by a live scripting debugger to notify the ScriptSystem about reloaded scripts.
public void LiveReload(ScriptComponent oldScript, ScriptComponent newScript)
Parameters
oldScriptScriptComponentThe old script
newScriptScriptComponentThe new script
NextFrame()
Allows to wait for next frame.
public ChannelMicroThreadAwaiter<int> NextFrame()
Returns
- ChannelMicroThreadAwaiter<int>
ChannelMicroThreadAwaiter<System.Int32>.
Remove(ScriptComponent)
Remove the provided script from the script system.
public void Remove(ScriptComponent script)
Parameters
scriptScriptComponentThe script to remove
Update(GameTime)
This method is called when this game component is updated.
public override void Update(GameTime gameTime)
Parameters
gameTimeGameTimeThe current timing.
WhenAll(params MicroThread[])
Waits all micro thread finished their task completion.
public Task WhenAll(params MicroThread[] microThreads)
Parameters
microThreadsMicroThread[]The micro threads.
Returns
- Task
Task.