Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script System Extensions for writing async methods #99

Merged
merged 1 commit into from
Jan 21, 2024

Conversation

DockFrankenstein
Copy link
Contributor

I've created script system extensions for writing async methods:

Delay

It makes creating a delay task more consistent with the rest of the extensions and uses seconds instead of milliseconds.

DelayWarped

Works similar to Delay, except that it considers the current Update Time factor. It will also adjust itself if the factor changes during the delay.

ExecuteInTime

Executes an action every frame for a specified amount of time. It's useful for things like animating. Example:

//Moves the entity by one meter up in the span of 2 seconds
await Script.ExecuteInTime(2f, t =>
{
    Entity.Transform.Position = Vector3.UnitY * Math.Clamp(t / 2f, 0f, 1f),
});

ExecuteInTime

Simular to ExecuteInTime, except that it considers the current Update Time factor.


The code includes documentation comments and I've included a script-system-extensions page in the manual

@VaclavElias VaclavElias merged commit b99ee93 into stride3d:main Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants