Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/belicusbr/com.cobilas.godot.utility
The package contains utility classes in csharp for godot engine
https://github.com/belicusbr/com.cobilas.godot.utility
csharp csharp-library csharp-net472 godot-utility godot3 godot3-5 godotengine
Last synced: 3 months ago
JSON representation
The package contains utility classes in csharp for godot engine
- Host: GitHub
- URL: https://github.com/belicusbr/com.cobilas.godot.utility
- Owner: BelicusBr
- License: mit
- Created: 2023-12-28T05:58:34.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-04T00:11:28.000Z (3 months ago)
- Last Synced: 2024-10-10T11:04:40.213Z (3 months ago)
- Topics: csharp, csharp-library, csharp-net472, godot-utility, godot3, godot3-5, godotengine
- Language: C#
- Homepage: https://belicusbr.github.io/com.cobilas.docs/gd-utility-getting-started.html
- Size: 107 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [Cobilas Godot Utility](https://belicusbr.github.io/com.cobilas.docs/mds/gd-utility-getting-started.html)
### 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`.
```c#
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.
```c#
using Godot;
using Cobilas.GodotEngine.Utility.Runtime;
[RunTimeInitializationClass]
public class ClassTest : Node {}
```
### RunTimeInitializationClass
```c#
/*
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?
```c#
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)`.
### IYield Classes
- RunTimeSecond is a framework that allows you to delay your coroutine in seconds. This class inherits `IYieldUpdate`.
- FixedRunTimeSecond is a framework that allows you to delay your coroutine in seconds. This class inherits `IYieldFixedUpdate`.
- IYieldUpdate is an interface that allows the coroutine to run in the `_Process(float)` function.
- IYieldFixedUpdate is an interface that allows the coroutine to run in the `_PhysicsProcess(float)` function.
- IYieldVolatile is an interface that allows the coroutine to run in the `Process(float)` or `_PhysicsProcess(float)` function.
- IYieldCoroutine is the base interface for Yield interfaces.
### Stop coroutines
Now to stop a coroutine.
```c#
public static void StopCoroutine(Coroutine Coroutine);
public static void StopAllCoroutines();
```
## Other classes
`InputKeyBoard` `Physics2D` `SceneManager` `GDDirectory` `Gizmos`## The [Cobilas Godot Utility](https://www.nuget.org/packages/Cobilas.Godot.Utility/) is on nuget.org
To include the package, open the `.csproj` file and add it.
```xml
```
Or use command line.
```
dotnet add package Cobilas.Godot.Utility --version 1.7.0
```