Skip to content

Releases: BelicusBr/com.cobilas.godot.utility

v.1.7.0

30 Sep 00:47
Compare
Choose a tag to compare

[1.7.0] (29/09/2024)

Added

New RunTime structure

Details

The RunTime structure has been added to provide runtime values ​​and functions.

Changed

Changes in RunTimeInitialization.

Details

Form changes to the RunTimeInitialization class such as placing the PriorityList structure outside the RunTimeInitialization class, allowing RunTimeInitialization to accept negative values ​​as priority.
The lower the priority value, the higher its execution level will be.

v1.6.0

30 Sep 00:46
Compare
Choose a tag to compare

[1.6.0] (26/09/2024)

Added

New structures and methods.

Details

New vector structures like Vector2Int and Vector3Int have been added.
The Vector2D, Vector3D and Vector4D structures received the Neg Method to negate the vector axes and the Round method.

v1.5.3

24 Sep 05:26
Compare
Choose a tag to compare

[1.5.3] (24/09/2024)

Fixed

Randomico.value is now a property.

Detalhes

Since Randomico.value was of field type, this made the return of pseudorandom methods static.

[1.5.2] (17/09/2024)

Fixed

StackOverflowException in Vector2D.Magnitude(in Vector2D)

Detalhes

The Vector2D.Magnitude(in Vector2D) method raised StackOverflowException by calling itself.

v1.5.1

23 Sep 02:30
Compare
Choose a tag to compare

[1.5.1] (12/09/2024)

Full Changelog: 1.3.0...1.5.1

Add

Vector Structure.

Detalhes

Vector structures such as 2d, 3d, 4d, and quaternion vectors have been added.

Fixed

ArgumentNullException in GDDirectory.GetGDDirectory() method.

Detalhes

The GDDirectory.GetGDDirectory() method always raised an ArgumentNullException due to the fact that the GDDirectory.GetGDDirectory() method uses the private GDDirectory.GetGDDirectory(string, GDFileBase) method, which received a null value in the parent parameter, but that, as of version 1.4.0, the parent parameter of the GDDirectory class constructor is now checked if it is null, which caused the GDDirectory.GetGDDirectory() method to break.

[1.4.0] (04/08/2024)

Add

The Randomico and GDIONull classes.

Detalhes

The Randomico class was added for pseudorandom value generation.
The GDIONull class was created to represent a null GDFileBase object.

v1.3.0

23 Sep 02:28
Compare
Choose a tag to compare

[1.3.0] (07/07/2024)

Add

The static class GDFeature was added to address the lack of specific preprocessing definitions.

Full Changelog: 1.2.1...1.3.0

v1.2.1

02 Jan 19:11
Compare
Choose a tag to compare

v1.2.0

02 Jan 19:11
Compare
Choose a tag to compare

v1.1.2

02 Jan 19:10
Compare
Choose a tag to compare

Fixed

O An exception of type InvalidCastexception in the explicit operator of the Hit2D structure where the Collision property could receive an object of another type than CollisionObject2D which would inevitably cause InvalidCastexception.
The explicit operator of the RayHit2D structure was also changed to avoid the same problem as the explicit operator of the Hit2D structure.

v1.1.0

30 Dec 00:57
Compare
Choose a tag to compare

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

The Cobilas Godot Utility is on nuget.org

To include the package, open the .csproj file and add it.

<ItemGroup>
  <PackageReference Include="Cobilas.Godot.Utility" Version="1.1.0" />
</ItemGroup>

Or use command line.

dotnet add package Cobilas.Godot.Utility --version 1.1.0