diff --git a/Icons/RJAction.svg b/Icons/RJAction.svg
new file mode 100644
index 0000000..405b1f8
--- /dev/null
+++ b/Icons/RJAction.svg
@@ -0,0 +1,52 @@
+
+
diff --git a/Icons/RJAction.svg.import b/Icons/RJAction.svg.import
new file mode 100644
index 0000000..f2c18f8
--- /dev/null
+++ b/Icons/RJAction.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://3o4jrbvgynae"
+path="res://.godot/imported/RJAction.svg-beb0a31def94ebf28119d2bd3d7976a9.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJAction.svg"
+dest_files=["res://.godot/imported/RJAction.svg-beb0a31def94ebf28119d2bd3d7976a9.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/RJActionList.svg b/Icons/RJActionList.svg
new file mode 100644
index 0000000..aed7b72
--- /dev/null
+++ b/Icons/RJActionList.svg
@@ -0,0 +1,107 @@
+
+
diff --git a/Icons/RJActionList.svg.import b/Icons/RJActionList.svg.import
new file mode 100644
index 0000000..a5e6e23
--- /dev/null
+++ b/Icons/RJActionList.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://bsgb2qdpdftr4"
+path="res://.godot/imported/RJActionList.svg-beaf5561f3ed1bddbcfc6914d2361da3.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJActionList.svg"
+dest_files=["res://.godot/imported/RJActionList.svg-beaf5561f3ed1bddbcfc6914d2361da3.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/RJIcon.svg b/Icons/RJIcon.svg
new file mode 100644
index 0000000..4b4c3cd
--- /dev/null
+++ b/Icons/RJIcon.svg
@@ -0,0 +1,43 @@
+
+
diff --git a/Icons/RJIcon.svg.import b/Icons/RJIcon.svg.import
new file mode 100644
index 0000000..3d30088
--- /dev/null
+++ b/Icons/RJIcon.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://cg5fnpnwnnlxp"
+path="res://.godot/imported/RJIcon.svg-0c4b76f83ee560c49146d5d0e2e2cd82.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJIcon.svg"
+dest_files=["res://.godot/imported/RJIcon.svg-0c4b76f83ee560c49146d5d0e2e2cd82.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/RJSelector.svg b/Icons/RJSelector.svg
new file mode 100644
index 0000000..b72f716
--- /dev/null
+++ b/Icons/RJSelector.svg
@@ -0,0 +1,43 @@
+
+
diff --git a/Icons/RJSelector.svg.import b/Icons/RJSelector.svg.import
new file mode 100644
index 0000000..c800add
--- /dev/null
+++ b/Icons/RJSelector.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://di5twkhxs6ldl"
+path="res://.godot/imported/RJSelector.svg-82cc12c5034e0b56287fb852d3c62b39.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJSelector.svg"
+dest_files=["res://.godot/imported/RJSelector.svg-82cc12c5034e0b56287fb852d3c62b39.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/RJSensor.svg b/Icons/RJSensor.svg
new file mode 100644
index 0000000..2829663
--- /dev/null
+++ b/Icons/RJSensor.svg
@@ -0,0 +1,231 @@
+
+
diff --git a/Icons/RJSensor.svg.import b/Icons/RJSensor.svg.import
new file mode 100644
index 0000000..e62f8e5
--- /dev/null
+++ b/Icons/RJSensor.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://cexdhupggsnhd"
+path="res://.godot/imported/RJSensor.svg-1fbd8106fb1975a47409ab98bb231c4f.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJSensor.svg"
+dest_files=["res://.godot/imported/RJSensor.svg-1fbd8106fb1975a47409ab98bb231c4f.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Runtime/Actions/ActionList.cs b/Runtime/Actions/ActionList.cs
index 2c2fb47..2eb1b47 100644
--- a/Runtime/Actions/ActionList.cs
+++ b/Runtime/Actions/ActionList.cs
@@ -4,7 +4,7 @@ using Godot;
namespace Rokojori
{
- [GlobalClass]
+ [GlobalClass,Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJActionList.svg")]
public partial class ActionList : RJAction
{
[Export]
@@ -12,14 +12,34 @@ namespace Rokojori
[Export]
public bool triggerDirectChildren = true;
- protected override void _OnTrigger()
+ public override void _OnTrigger()
{
- for ( int i = 0; i < actions.Length; i++ )
- {
- Actions.Trigger( actions[ i ] );
- }
+ if ( actions != null )
+ {
+ for ( int i = 0; i < actions.Length; i++ )
+ {
+ Actions.Trigger( actions[ i ] );
+ }
+ }
-
+ if ( ! triggerDirectChildren )
+ {
+ return;
+ }
+
+ var childCount = GetChildCount();
+
+ for ( int i = 0; i < childCount; i++ )
+ {
+ var action = GetChild( i ) as RJAction;
+
+ if ( action == null )
+ {
+ continue;
+ }
+
+ Actions.Trigger( action );
+ }
}
}
diff --git a/Runtime/Actions/Actions.cs b/Runtime/Actions/Actions.cs
index 51e522a..9b5e8a7 100644
--- a/Runtime/Actions/Actions.cs
+++ b/Runtime/Actions/Actions.cs
@@ -6,7 +6,7 @@ namespace Rokojori
{
public class Actions
{
- public static Trigger( RJAction action )
+ public static void Trigger( RJAction action )
{
if ( action == null )
{
diff --git a/Runtime/Actions/GDPrint.cs b/Runtime/Actions/GDPrint.cs
new file mode 100644
index 0000000..95d4815
--- /dev/null
+++ b/Runtime/Actions/GDPrint.cs
@@ -0,0 +1,18 @@
+
+using Godot;
+
+
+namespace Rokojori
+{
+ [GlobalClass]
+ public partial class GDPrint : RJAction
+ {
+ [Export]
+ public string message;
+
+ public override void _OnTrigger()
+ {
+ RJLog.Log( message );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Actions/OnReady.cs b/Runtime/Actions/OnReady.cs
new file mode 100644
index 0000000..5fdcfbe
--- /dev/null
+++ b/Runtime/Actions/OnReady.cs
@@ -0,0 +1,19 @@
+
+using Godot;
+
+
+namespace Rokojori
+{
+ [GlobalClass]
+ public partial class OnReady : Node
+ {
+ [Export]
+ public RJAction action;
+
+ public override void _Ready()
+ {
+ RJLog.Log( "OnReady" );
+ Actions.Trigger( action );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Godot/Nodes.cs b/Runtime/Godot/Nodes.cs
index 2c2992b..d83d63f 100644
--- a/Runtime/Godot/Nodes.cs
+++ b/Runtime/Godot/Nodes.cs
@@ -49,7 +49,9 @@ namespace Rokojori
public static T GetAnyChild( Node parent ) where T:Node
{
return (T) nodesWalker.Find( parent, ( n )=> n is T, true );
- }
+ }
+
+ /*
public static void Enable( Node n, bool affectProcess = true, bool affectPhysicsProcess = true, bool affectInput = true )
{
@@ -68,6 +70,8 @@ namespace Rokojori
nodesWalker.Iterate( nodes[ i ], callback );
}
}
+
+ */
}
}
diff --git a/Runtime/Graphs/Trees/Iterators/SingleIterator.cs b/Runtime/Graphs/Trees/Iterators/SingleIterator.cs
index b744115..a2a8ba2 100644
--- a/Runtime/Graphs/Trees/Iterators/SingleIterator.cs
+++ b/Runtime/Graphs/Trees/Iterators/SingleIterator.cs
@@ -2,16 +2,16 @@ using System.Collections;
using System.Collections.Generic;
-namespace Rokojori.Core
+namespace Rokojori
{
- public class SinlgeIterator: TreeIterator where N:class
+ public class SingleIterator: TreeIterator where N:class
{
N node;
N current;
- public static SinlgeIterator Create( N node )
+ public static SingleIterator Create( N node )
{
- var iterator = new SinlgeIterator();
+ var iterator = new SingleIterator();
iterator.node = node;
iterator.current = null;
diff --git a/Runtime/Graphs/Trees/TreeIterator.cs b/Runtime/Graphs/Trees/TreeIterator.cs
index c9689d0..168e676 100644
--- a/Runtime/Graphs/Trees/TreeIterator.cs
+++ b/Runtime/Graphs/Trees/TreeIterator.cs
@@ -106,28 +106,28 @@ namespace Rokojori
switch ( type )
{
case TreeIteratorType.Parent:
- return SinlgeIterator.Create( walker.Parent( node ) );
+ return SingleIterator.Create( walker.Parent( node ) );
case TreeIteratorType.NextSibling:
- return SinlgeIterator.Create( walker.NextSibling( node ) );
+ return SingleIterator.Create( walker.NextSibling( node ) );
case TreeIteratorType.PreviousSibling:
- return SinlgeIterator.Create( walker.PreviousSibling( node ) );
+ return SingleIterator.Create( walker.PreviousSibling( node ) );
case TreeIteratorType.FirstChild:
- return SinlgeIterator.Create( walker.ChildAt( node, 0 ) );
+ return SingleIterator.Create( walker.ChildAt( node, 0 ) );
case TreeIteratorType.LastChild:
- return SinlgeIterator.Create( walker.ChildAt( node, walker.NumChildren( node ) - 1 ) );
+ return SingleIterator.Create( walker.ChildAt( node, walker.NumChildren( node ) - 1 ) );
case TreeIteratorType.LastGrandChild:
- return SinlgeIterator.Create( walker.LastGrandChild( node ) );
+ return SingleIterator.Create( walker.LastGrandChild( node ) );
case TreeIteratorType.NextNode:
- return SinlgeIterator.Create( walker.NextNode( node ) );
+ return SingleIterator.Create( walker.NextNode( node ) );
case TreeIteratorType.PreviousNode:
- return SinlgeIterator.Create( walker.PreviousNode( node ) );
+ return SingleIterator.Create( walker.PreviousNode( node ) );
case TreeIteratorType.Parents:
diff --git a/Runtime/Logging/RJLog.cs b/Runtime/Logging/RJLog.cs
new file mode 100644
index 0000000..b33d304
--- /dev/null
+++ b/Runtime/Logging/RJLog.cs
@@ -0,0 +1,41 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using System;
+using System.Linq;
+using Godot;
+
+namespace Rokojori
+{
+ public class RJLog
+ {
+
+ static void Stringify( object obj, StringBuilder output )
+ {
+ output.Append( obj.ToString() );
+ }
+
+ static void LogMessage( string message )
+ {
+ GD.Print( message );
+ }
+
+ public static void Log( params object[] objects)
+ {
+ var sb = new StringBuilder();
+
+ for ( int i = 0; i < objects.Length; i++ )
+ {
+ if ( i != 0 )
+ {
+ sb.Append( " " );
+ }
+
+ Stringify( objects[ i ], sb );
+ }
+
+ LogMessage( sb.ToString() );
+ }
+ }
+
+}
diff --git a/Runtime/Sensors/InputSensor.cs b/Runtime/Sensors/InputSensor.cs
new file mode 100644
index 0000000..6035434
--- /dev/null
+++ b/Runtime/Sensors/InputSensor.cs
@@ -0,0 +1,47 @@
+
+using Godot;
+
+
+namespace Rokojori
+{
+ [GlobalClass,Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJSensor.svg")]
+ public partial class InputSensor : RJSensor
+ {
+ [Export]
+ public string inputActionName = "";
+
+ float _value = 0;
+ bool _wasActive = false;
+ bool _isActive = false;
+
+ public override float GetValue()
+ {
+ return _value;
+ }
+
+ public override bool IsActive()
+ {
+ return _isActive;
+ }
+
+ public override bool WasActive()
+ {
+ return _wasActive;
+ }
+
+ public override void UpdateValue( float value )
+ {
+ _value = value;
+
+ _wasActive = _isActive;
+ _isActive = _value > 0;
+ }
+
+ public override void _Process( double delta )
+ {
+ var inputValue = Input.GetActionRawStrength( inputActionName );
+ UpdateValue( inputValue );
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Sensors/OnSensor.cs b/Runtime/Sensors/OnSensor.cs
new file mode 100644
index 0000000..5b3f374
--- /dev/null
+++ b/Runtime/Sensors/OnSensor.cs
@@ -0,0 +1,52 @@
+
+using Godot;
+
+
+namespace Rokojori
+{
+ [GlobalClass]
+ public partial class OnSensor: Node
+ {
+ [Export]
+ public RJSensor sensor;
+
+ [Export]
+ public RJAction onStart;
+
+ [Export]
+ public RJAction onActive;
+
+ [Export]
+ public RJAction onEnd;
+
+ public override void _Process( double delta)
+ {
+ var active = sensor.IsActive();
+ var wasActive = sensor.WasActive();
+
+ if ( ! active && ! wasActive )
+ {
+ return;
+ }
+
+ var started = ! wasActive && active;
+ var ended = wasActive && ! active;
+
+ if ( started )
+ {
+ Actions.Trigger( onStart );
+ }
+
+ if ( active )
+ {
+ Actions.Trigger( onActive );
+ }
+
+ if ( ended )
+ {
+ Actions.Trigger( onActive );
+ }
+
+ }
+ }
+}
\ No newline at end of file