Basic player controls and aiming
This commit is contained in:
parent
56695d303e
commit
f5999da412
114 changed files with 6611 additions and 2 deletions
38
addons/godot_state_charts/csharp/Transition.cs
Normal file
38
addons/godot_state_charts/csharp/Transition.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
|
||||
namespace GodotStateCharts
|
||||
{
|
||||
using Godot;
|
||||
|
||||
/// <summary>
|
||||
/// A transition between two states.
|
||||
/// </summary>
|
||||
public class Transition : NodeWrapper {
|
||||
|
||||
/// <summary>
|
||||
/// Called when the transition is taken.
|
||||
/// </summary>
|
||||
public event Action Taken {
|
||||
add => Wrapped.Connect(SignalName.Taken, Callable.From(value));
|
||||
remove => Wrapped.Disconnect(SignalName.Taken, Callable.From(value));
|
||||
}
|
||||
|
||||
private Transition(Node transition) : base(transition) {}
|
||||
|
||||
public static Transition Of(Node transition) {
|
||||
if (transition.GetScript().As<Script>() is not GDScript gdScript
|
||||
|| !gdScript.ResourcePath.EndsWith("transition.gd"))
|
||||
{
|
||||
throw new ArgumentException("Given node is not a transition.");
|
||||
}
|
||||
return new Transition(transition);
|
||||
}
|
||||
|
||||
|
||||
public class SignalName : Godot.Node.SignalName
|
||||
{
|
||||
/// <see cref="Transition.Taken"/>
|
||||
public static readonly StringName Taken = "taken";
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue