gd,refacto: added state chart addon and namespace cleanup

This commit is contained in:
2025-06-05 14:47:51 +02:00
parent 8818e77d23
commit 5c36765a36
239 changed files with 10430 additions and 115 deletions

View File

@ -0,0 +1,27 @@

using GodotStateCharts;
namespace Movementtests.godot_state_charts_examples.csharp;
/// <summary>
/// This is an example on how to add extension methods to the state chart class to get
/// more type safety and a nicer API.
/// </summary>
// ReSharper disable once CheckNamespace
public static class StateChartExt
{
public static void SetPoisonCount(this StateChart stateChart, int poisonCount)
{
stateChart.SetExpressionProperty("poison_count", poisonCount);
}
public static int GetPoisonCount(this StateChart stateChart)
{
return stateChart.GetExpressionProperty("poison_count", 0);
}
public static void SendCuredEvent(this StateChart stateChart)
{
stateChart.SendEvent("cured");
}
}