Cobilas.Godot.Utility
1.1.0
See the version list below for details.
dotnet add package Cobilas.Godot.Utility --version 1.1.0
NuGet\Install-Package Cobilas.Godot.Utility -Version 1.1.0
<PackageReference Include="Cobilas.Godot.Utility" Version="1.1.0" />
paket add Cobilas.Godot.Utility --version 1.1.0
#r "nuget: Cobilas.Godot.Utility, 1.1.0"
// Install Cobilas.Godot.Utility as a Cake Addin #addin nuget:?package=Cobilas.Godot.Utility&version=1.1.0 // Install Cobilas.Godot.Utility as a Cake Tool #tool nuget:?package=Cobilas.Godot.Utility&version=1.1.0
Cobilas Godot Utility
Descripition
The package contains utility classes in csharp for godot engine(Godot3.5)
RunTimeInitialization
(namespace: Cobilas.GodotEngine.Utility.Runtime)
The RunTimeInitialization
class allows you to automate the Project>Project Settings>AutoLoad
option.
To use the RunTimeInitialization
class, you must create a class and make it inherit RunTimeInitialization
.
using Cobilas.GodotEngine.Utility.Runtime;
//The name of the class is up to you.
public class RunTimeProcess : RunTimeInitialization {}
And remember to add the class that inherits RunTimeInitialization
in Project>Project Settings>AutoLoad
.
Remembering that the RunTimeInitialization
class uses the virtual method _Ready()
to perform the initialization of other classes.
And to initialize other classes along with the RunTimeInitialization
class, the class must inherit the Godot.Node
class or some class that inherits Godot.Node
and use the RunTimeInitializationClassAttribute
attribute.
using Godot;
using Cobilas.GodotEngine.Utility.Runtime;
[RunTimeInitializationClass]
public class ClassTest : Node {}
RunTimeInitializationClass
/*
bootPriority: Represents the boot order
{ (enum Priority)values
StartBefore,
StartLater
}
name:The name of the object
subPriority: And the execution priority order.
*/
[RunTimeInitializationClass(Priority bootPriority, string name, int subPriority)]
[RunTimeInitializationClass(Priority bootPriority)]
[RunTimeInitializationClass(Priority bootPriority, string name)]
[RunTimeInitializationClass(string name, int subPriority)]
[RunTimeInitializationClass(string name)]
[RunTimeInitializationClass()]
CoroutineManager
The CoroutineManager
class is responsible for creating and managing coroutines for godot.
How to create a coroutine?
using Godot;
using System.Collections;
using Cobilas.GodotEngine.Utility;
public class ClassTest : Node {
private Coroutine coroutine;
public override void _Ready() {
coroutine = CoroutineManager.StartCoroutine(Corroutine1());
coroutine = CoroutineManager.StartCoroutine(Corroutine2());
coroutine = CoroutineManager.StartCoroutine(Corroutine3());
}
private IEnumerator Corroutine1() {
GD.Print("Zé da manga");
//When the return is null, by default the coroutine is executed as _Process().
yield return null;
}
private IEnumerator Corroutine2() {
GD.Print("Zé da manga");
//When the return is RunTimeSecond the coroutine is executed as _Process() with a pre-defined delay.
yield return new RunTimeSecond(3);
}
private IEnumerator Corroutine3() {
GD.Print("Zé da manga");
When the return is RunTimeSecond the coroutine is executed as _PhysicProcess() with a pre-defined delay.
yield return new FixedRunTimeSecond(3);
}
}
With the IYieldVolatile
interface you can switch coroutine execution between _Process(float)
and _PhysicsProcess(float)
.
Stop coroutines
Now to stop a coroutine.
public static void StopCoroutine(Coroutine Coroutine);
public static void StopAllCoroutines();
Other classes
InputKeyBoard
Physics2D
SceneManager
GDDirectory
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- Cobilas.Core.Net4x (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.