diff --git a/Icons/ActionReference.svg b/Icons/ActionReference.svg new file mode 100644 index 0000000..d4b6cac --- /dev/null +++ b/Icons/ActionReference.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + diff --git a/Icons/ActionReference.svg.import b/Icons/ActionReference.svg.import new file mode 100644 index 0000000..82d074d --- /dev/null +++ b/Icons/ActionReference.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://duhsxh41rj48u" +path="res://.godot/imported/ActionReference.svg-c8fb5a8b48f776087d503c5e6bb31262.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/ActionReference.svg" +dest_files=["res://.godot/imported/ActionReference.svg-c8fb5a8b48f776087d503c5e6bb31262.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/Delay.svg b/Icons/Delay.svg new file mode 100644 index 0000000..d9a2ac3 --- /dev/null +++ b/Icons/Delay.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + diff --git a/Icons/Delay.svg.import b/Icons/Delay.svg.import new file mode 100644 index 0000000..720267c --- /dev/null +++ b/Icons/Delay.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://no1as5743t88" +path="res://.godot/imported/Delay.svg-55b4fee932c1b1f86a7aa30a14efa252.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/Delay.svg" +dest_files=["res://.godot/imported/Delay.svg-55b4fee932c1b1f86a7aa30a14efa252.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/Flash.svg b/Icons/Flash.svg new file mode 100644 index 0000000..95ef4ae --- /dev/null +++ b/Icons/Flash.svg @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Icons/Flash.svg.import b/Icons/Flash.svg.import new file mode 100644 index 0000000..a44b75a --- /dev/null +++ b/Icons/Flash.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c14m0vtgdhb3d" +path="res://.godot/imported/Flash.svg-0f97d7c882068d95d6b8a0079f65c075.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/Flash.svg" +dest_files=["res://.godot/imported/Flash.svg-0f97d7c882068d95d6b8a0079f65c075.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/GameObject.svg b/Icons/GameObject.svg new file mode 100644 index 0000000..c51baee --- /dev/null +++ b/Icons/GameObject.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Icons/GameObject.svg.import b/Icons/GameObject.svg.import new file mode 100644 index 0000000..66638c1 --- /dev/null +++ b/Icons/GameObject.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5mlda56po2hp" +path="res://.godot/imported/GameObject.svg-5aaaf52a9b7c93870833ac30a92a9404.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/GameObject.svg" +dest_files=["res://.godot/imported/GameObject.svg-5aaaf52a9b7c93870833ac30a92a9404.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/Highlight.svg b/Icons/Highlight.svg new file mode 100644 index 0000000..34bc5df --- /dev/null +++ b/Icons/Highlight.svg @@ -0,0 +1,52 @@ + + + + + + diff --git a/Icons/Highlight.svg.import b/Icons/Highlight.svg.import new file mode 100644 index 0000000..ff3e9d1 --- /dev/null +++ b/Icons/Highlight.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dwah0f53fb23w" +path="res://.godot/imported/Highlight.svg-a55ad2c807710de7bda8f3b493375d19.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/Highlight.svg" +dest_files=["res://.godot/imported/Highlight.svg-a55ad2c807710de7bda8f3b493375d19.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/NodeContainer.svg b/Icons/NodeContainer.svg new file mode 100644 index 0000000..72a1efa --- /dev/null +++ b/Icons/NodeContainer.svg @@ -0,0 +1,257 @@ + + diff --git a/Icons/NodeContainer.svg.import b/Icons/NodeContainer.svg.import new file mode 100644 index 0000000..d574f16 --- /dev/null +++ b/Icons/NodeContainer.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5mjmkwxm3pl2" +path="res://.godot/imported/NodeContainer.svg-7d84459703b9a51f7b6a562d9b1fe1e4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/NodeContainer.svg" +dest_files=["res://.godot/imported/NodeContainer.svg-7d84459703b9a51f7b6a562d9b1fe1e4.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/PlayParticles.svg b/Icons/PlayParticles.svg new file mode 100644 index 0000000..8728457 --- /dev/null +++ b/Icons/PlayParticles.svg @@ -0,0 +1,63 @@ + + diff --git a/Icons/PlayParticles.svg.import b/Icons/PlayParticles.svg.import new file mode 100644 index 0000000..7f5e455 --- /dev/null +++ b/Icons/PlayParticles.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://pjfsw1nio06n" +path="res://.godot/imported/PlayParticles.svg-6cb87d22273fc8548adfa8ff33c2b554.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/PlayParticles.svg" +dest_files=["res://.godot/imported/PlayParticles.svg-6cb87d22273fc8548adfa8ff33c2b554.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/PlaySound.svg b/Icons/PlaySound.svg new file mode 100644 index 0000000..f9b7dd6 --- /dev/null +++ b/Icons/PlaySound.svg @@ -0,0 +1,62 @@ + + diff --git a/Icons/PlaySound.svg.import b/Icons/PlaySound.svg.import new file mode 100644 index 0000000..c2d89b3 --- /dev/null +++ b/Icons/PlaySound.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dji27lpb5fm5r" +path="res://.godot/imported/PlaySound.svg-1209f1a361e815a85f8a737622ed992a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/PlaySound.svg" +dest_files=["res://.godot/imported/PlaySound.svg-1209f1a361e815a85f8a737622ed992a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/RemoveNode.svg b/Icons/RemoveNode.svg new file mode 100644 index 0000000..2d0bc34 --- /dev/null +++ b/Icons/RemoveNode.svg @@ -0,0 +1,60 @@ + + + + + + + + diff --git a/Icons/RemoveNode.svg.import b/Icons/RemoveNode.svg.import new file mode 100644 index 0000000..d03c899 --- /dev/null +++ b/Icons/RemoveNode.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dtlp22f6eucdx" +path="res://.godot/imported/RemoveNode.svg-ea64d9c92780f62863f63fb07def1a1d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/RemoveNode.svg" +dest_files=["res://.godot/imported/RemoveNode.svg-ea64d9c92780f62863f63fb07def1a1d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/SetNodeState.svg b/Icons/SetNodeState.svg new file mode 100644 index 0000000..ca9adb5 --- /dev/null +++ b/Icons/SetNodeState.svg @@ -0,0 +1,84 @@ + + + + + + + + + + diff --git a/Icons/SetNodeState.svg.import b/Icons/SetNodeState.svg.import new file mode 100644 index 0000000..7710c31 --- /dev/null +++ b/Icons/SetNodeState.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bkspusg5cer6r" +path="res://.godot/imported/SetNodeState.svg-f631065649940f1048d2ff179aa37d74.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/SetNodeState.svg" +dest_files=["res://.godot/imported/SetNodeState.svg-f631065649940f1048d2ff179aa37d74.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/Shake.svg b/Icons/Shake.svg new file mode 100644 index 0000000..79c7bf1 --- /dev/null +++ b/Icons/Shake.svg @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Icons/Shake.svg.import b/Icons/Shake.svg.import new file mode 100644 index 0000000..40df09f --- /dev/null +++ b/Icons/Shake.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://e23elb0y6xy2" +path="res://.godot/imported/Shake.svg-3dcc885b30e2fb9abc4bfe77de6a75ca.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/Shake.svg" +dest_files=["res://.godot/imported/Shake.svg-3dcc885b30e2fb9abc4bfe77de6a75ca.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/Tween.svg b/Icons/Tween.svg new file mode 100644 index 0000000..cc76973 --- /dev/null +++ b/Icons/Tween.svg @@ -0,0 +1,81 @@ + + + + + + + + + diff --git a/Icons/Tween.svg.import b/Icons/Tween.svg.import new file mode 100644 index 0000000..2b5e5d1 --- /dev/null +++ b/Icons/Tween.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://4ij1bv8iou60" +path="res://.godot/imported/Tween.svg-af725ef863db4347b888e6a4a0351122.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rokojori_action_library/Icons/Tween.svg" +dest_files=["res://.godot/imported/Tween.svg-af725ef863db4347b888e6a4a0351122.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/Action.cs b/Runtime/Actions/Action.cs index b1563b0..7d67e47 100644 --- a/Runtime/Actions/Action.cs +++ b/Runtime/Actions/Action.cs @@ -61,6 +61,11 @@ namespace Rokojori public void Trigger() { + if ( ! IsInstanceValid( this ) ) + { + return; + } + _isNetworkedTrigger = false; _sendsSeed = false; _sendsData = false; diff --git a/Runtime/Actions/ActionReference.cs b/Runtime/Actions/ActionReference.cs index 4abb6f6..0c84072 100644 --- a/Runtime/Actions/ActionReference.cs +++ b/Runtime/Actions/ActionReference.cs @@ -4,7 +4,7 @@ using Godot; namespace Rokojori { - [Tool][GlobalClass ] + [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/ActionReference.svg")] public partial class ActionReference : Action { [Export] diff --git a/Runtime/Actions/Conditional/CoolDown.cs b/Runtime/Actions/Conditional/CoolDown.cs index fdcb97e..3e92159 100644 --- a/Runtime/Actions/Conditional/CoolDown.cs +++ b/Runtime/Actions/Conditional/CoolDown.cs @@ -18,6 +18,27 @@ namespace Rokojori bool _isCoolingDown = false; int _coolDownID = -1; + public void RegisterCoolDown() + { + _isCoolingDown = coolDownDuration != null; + + var te = TimeLineManager.ScheduleEventIn( + coolDownDuration.timeLine, + coolDownDuration.GetDurationInSeconds(), + ev => + { + if ( _coolDownID != ev.id ) + { + return; + } + + _isCoolingDown = false; + } + ); + + _coolDownID = te.id; + } + public void ResetCoolDown() { if ( _coolDownID == -1 ) @@ -36,27 +57,9 @@ namespace Rokojori return; } - _isCoolingDown = coolDownDuration != null; + Trigger( action ); - - if ( coolDownDuration != null ) - { - var te = TimeLineManager.ScheduleEventIn( - coolDownDuration.timeLine, coolDownDuration.GetDurationInSeconds(), - ev => - { - if ( _coolDownID != ev.id ) - { - return; - } - - _isCoolingDown = false; - } - ); - - _coolDownID = te.id; - - } + RegisterCoolDown(); } } diff --git a/Runtime/Actions/Conditional/RegisterCoolDown.cs b/Runtime/Actions/Conditional/RegisterCoolDown.cs new file mode 100644 index 0000000..4603b54 --- /dev/null +++ b/Runtime/Actions/Conditional/RegisterCoolDown.cs @@ -0,0 +1,20 @@ + +using Godot; +using System.Collections.Generic; + + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/ConditionalAction.svg")] + public partial class RegisterCoolDown : Action + { + [Export] + public CoolDown coolDown; + + protected override void _OnTrigger() + { + coolDown.RegisterCoolDown(); + } + } +} \ No newline at end of file diff --git a/Runtime/Actions/Conditional/RegisterCoolDown.cs.uid b/Runtime/Actions/Conditional/RegisterCoolDown.cs.uid new file mode 100644 index 0000000..3158271 --- /dev/null +++ b/Runtime/Actions/Conditional/RegisterCoolDown.cs.uid @@ -0,0 +1 @@ +uid://ckbjnp2ort0j0 diff --git a/Runtime/Actions/Node/SetNodeState.cs b/Runtime/Actions/Node/SetNodeState.cs index c85d7c8..6e09371 100644 --- a/Runtime/Actions/Node/SetNodeState.cs +++ b/Runtime/Actions/Node/SetNodeState.cs @@ -4,7 +4,7 @@ using Godot; namespace Rokojori { - [Tool][GlobalClass ] + [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/SetNodeState.svg")] public partial class SetNodeState : Action { [Export] diff --git a/Runtime/Actions/Node/SetNodeStateSpecific.cs b/Runtime/Actions/Node/SetNodeStateSpecific.cs index 01a7a3f..b877358 100644 --- a/Runtime/Actions/Node/SetNodeStateSpecific.cs +++ b/Runtime/Actions/Node/SetNodeStateSpecific.cs @@ -4,7 +4,7 @@ using Godot; namespace Rokojori { - [Tool][GlobalClass ] + [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/SetNodeState.svg")] public partial class SetNodeStateSpecific : Action { [Export] diff --git a/Runtime/Actions/Node3D/CopyPosition.cs b/Runtime/Actions/Node3D/CopyPosition.cs index 677ce2e..65bd6c1 100644 --- a/Runtime/Actions/Node3D/CopyPosition.cs +++ b/Runtime/Actions/Node3D/CopyPosition.cs @@ -13,6 +13,9 @@ namespace Rokojori [Export] public Node3D target; + [Export] + public Vector3 offset = Vector3.Zero; + [Export] public bool global = true; @@ -27,15 +30,17 @@ namespace Rokojori if ( source == null || target == null ) { return; - } + } + + if ( global ) { - target.GlobalPosition = source.GlobalPosition; + target.GlobalPosition = source.GlobalPosition + offset; } else { - target.Position = source.Position; + target.Position = source.Position + offset; } } } diff --git a/Runtime/Actions/Node3D/CopyYaw.cs b/Runtime/Actions/Node3D/CopyYaw.cs new file mode 100644 index 0000000..4eaf05c --- /dev/null +++ b/Runtime/Actions/Node3D/CopyYaw.cs @@ -0,0 +1,29 @@ + +using Godot; + + +namespace Rokojori +{ + [Tool][GlobalClass ] + public partial class CopyYaw : Action + { + [Export] + public Node3D source; + + [Export] + public Node3D target; + + protected override void _OnTrigger() + { + if ( source == null || target == null ) + { + return; + } + + target.SetGlobalYaw( source.GlobalYawRadians() ); + + } + + + } +} \ No newline at end of file diff --git a/Runtime/Actions/Node3D/CopyYaw.cs.uid b/Runtime/Actions/Node3D/CopyYaw.cs.uid new file mode 100644 index 0000000..6604a83 --- /dev/null +++ b/Runtime/Actions/Node3D/CopyYaw.cs.uid @@ -0,0 +1 @@ +uid://bekhujf301q48 diff --git a/Runtime/Actions/Node3D/PlayParticles.cs b/Runtime/Actions/Node3D/PlayParticles.cs index e867b63..8f7d85c 100644 --- a/Runtime/Actions/Node3D/PlayParticles.cs +++ b/Runtime/Actions/Node3D/PlayParticles.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Rokojori { - [Tool][GlobalClass] + [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/PlayParticles.svg")] public partial class PlayParticles:Action { [Export] @@ -43,7 +43,7 @@ namespace Rokojori p = DuplicateParticles(); } - this.LogInfo( "Using Particles", p ); + // this.LogInfo( "Using Particles", p ); diff --git a/Runtime/Actions/Node3D/PlaySound.cs b/Runtime/Actions/Node3D/PlaySound.cs index f7081ef..eeb3cfe 100644 --- a/Runtime/Actions/Node3D/PlaySound.cs +++ b/Runtime/Actions/Node3D/PlaySound.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Rokojori { - [Tool][GlobalClass] + [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/PlaySound.svg")] public partial class PlaySound:Action { [Export] @@ -50,12 +50,17 @@ namespace Rokojori return freePlayer; } - var newPlayer = player.GetParent().CreateChild(); - newPlayer.Stream = player.Stream; - newPlayer.VolumeDb = player.VolumeDb; - newPlayer.MaxDb = player.MaxDb; - newPlayer.UnitSize = player.UnitSize; - newPlayer.AttenuationModel = player.AttenuationModel; + var newPlayer = player.GetParent().CreateChildFromDuplicate( player ) as AudioStreamPlayer3D; + + + // newPlayer.Stream = player.Stream; + // newPlayer.AttenuationModel = player.att + // newPlayer.VolumeDb = player.VolumeDb; + // newPlayer.MaxDb = player.MaxDb; + // newPlayer.UnitSize = player.UnitSize; + // newPlayer.AttenuationModel = player.AttenuationModel; + // newPlayer.PitchScale = player.PitchScale; + players.Add( newPlayer ); return newPlayer; @@ -67,7 +72,7 @@ namespace Rokojori var audioManager = Unique.Get(); - if ( overdrivePreventionDuration != null && overdrivePreventionFlag != null ) + if ( overdrivePreventionDuration != null && overdrivePreventionFlag != null && audioManager != null ) { if ( ! audioManager.CanPlay( overdrivePreventionFlag, overdrivePreventionDuration.GetDurationInSeconds() ) ) { @@ -105,12 +110,12 @@ namespace Rokojori // this.LogInfo( "Play sound", offset, HierarchyName.Of( player ) ); - if ( overdrivePreventionFlag != null ) + if ( overdrivePreventionFlag != null && audioManager != null ) { audioManager.RecordSoundPlaying( overdrivePreventionFlag ); } - if ( randomizePlaybackPosition ) + if ( audioManager != null && randomizePlaybackPosition ) { var tl = TimeLineManager.Ensure( durationPerSound.timeLine ); diff --git a/Runtime/Actions/Node3D/TweenAudio.cs b/Runtime/Actions/Node3D/TweenAudio.cs index 9db5cb6..d614a97 100644 --- a/Runtime/Actions/Node3D/TweenAudio.cs +++ b/Runtime/Actions/Node3D/TweenAudio.cs @@ -6,7 +6,7 @@ using Godot; namespace Rokojori { [Tool] - [GlobalClass ] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Tween.svg")] public partial class TweenAudio:SequenceAction, Animator { diff --git a/Runtime/Actions/RemoveNode.cs b/Runtime/Actions/RemoveNode.cs index 79ed1f4..6fa7b57 100644 --- a/Runtime/Actions/RemoveNode.cs +++ b/Runtime/Actions/RemoveNode.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; namespace Rokojori { - [Tool][GlobalClass] + [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/RemoveNode.svg")] public partial class RemoveNode : Action { [Export] diff --git a/Runtime/Actions/Time/Delay.cs b/Runtime/Actions/Time/Delay.cs index d50e47b..4994627 100644 --- a/Runtime/Actions/Time/Delay.cs +++ b/Runtime/Actions/Time/Delay.cs @@ -4,7 +4,7 @@ using Godot; namespace Rokojori { - [Tool][GlobalClass] + [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Delay.svg")] public partial class Delay : SequenceAction { [Export] diff --git a/Runtime/Actions/UI/SetMouseMode.cs b/Runtime/Actions/UI/SetMouseMode.cs new file mode 100644 index 0000000..7a878fd --- /dev/null +++ b/Runtime/Actions/UI/SetMouseMode.cs @@ -0,0 +1,19 @@ + +using Godot; + + +namespace Rokojori +{ + [Tool] + [GlobalClass ] + public partial class SetMouseMode : Action + { + [Export] + public Input.MouseModeEnum mouseMode; + + protected override void _OnTrigger() + { + Input.MouseMode = mouseMode; + } + } +} \ No newline at end of file diff --git a/Runtime/Actions/UI/SetMouseMode.cs.uid b/Runtime/Actions/UI/SetMouseMode.cs.uid new file mode 100644 index 0000000..295dd1c --- /dev/null +++ b/Runtime/Actions/UI/SetMouseMode.cs.uid @@ -0,0 +1 @@ +uid://dcn7h7c2rguhq diff --git a/Runtime/Actions/Visual/TweenFloat.cs b/Runtime/Actions/Visual/TweenFloat.cs index 55f687c..0a8ba83 100644 --- a/Runtime/Actions/Visual/TweenFloat.cs +++ b/Runtime/Actions/Visual/TweenFloat.cs @@ -6,7 +6,7 @@ using Godot; namespace Rokojori { [Tool] - [GlobalClass ] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Tween.svg")] public partial class TweenFloat:SequenceAction, Animator { [Export] diff --git a/Runtime/Actions/Visual/TweenFloatShaderProperty.cs b/Runtime/Actions/Visual/TweenFloatShaderProperty.cs index ef3a3c4..f873a24 100644 --- a/Runtime/Actions/Visual/TweenFloatShaderProperty.cs +++ b/Runtime/Actions/Visual/TweenFloatShaderProperty.cs @@ -6,7 +6,7 @@ using Godot; namespace Rokojori { [Tool] - [GlobalClass ] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Tween.svg")] public partial class TweenFloatShaderProperty:SequenceAction, Animator { [Export] diff --git a/Runtime/Actions/Visual/TweenLight.cs b/Runtime/Actions/Visual/TweenLight.cs index be3e0f0..d1e507e 100644 --- a/Runtime/Actions/Visual/TweenLight.cs +++ b/Runtime/Actions/Visual/TweenLight.cs @@ -6,7 +6,7 @@ using Godot; namespace Rokojori { [Tool] - [GlobalClass ] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Tween.svg")] public partial class TweenLight:SequenceAction { [Export] diff --git a/Runtime/Actions/Visual/TweenMaterial.cs b/Runtime/Actions/Visual/TweenMaterial.cs index 53fa794..78b8b11 100644 --- a/Runtime/Actions/Visual/TweenMaterial.cs +++ b/Runtime/Actions/Visual/TweenMaterial.cs @@ -6,7 +6,7 @@ using Godot; namespace Rokojori { [Tool] - [GlobalClass ] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Tween.svg")] public partial class TweenMaterial : SequenceAction, Animator { public void OnAnimatorStart(){} @@ -81,7 +81,7 @@ namespace Rokojori protected override void _OnTrigger() { - if ( toMaterial == null && this._assignedMaterial == null ) + if ( toMaterial == null && this._assignedMaterial == null || target == null ) { return; } diff --git a/Runtime/Actions/Visual/TweenParticles.cs b/Runtime/Actions/Visual/TweenParticles.cs index 5697c82..17a3f82 100644 --- a/Runtime/Actions/Visual/TweenParticles.cs +++ b/Runtime/Actions/Visual/TweenParticles.cs @@ -6,7 +6,7 @@ using Godot; namespace Rokojori { [Tool] - [GlobalClass ] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Tween.svg")] public partial class TweenParticles:SequenceAction { [Export] diff --git a/Runtime/Actions/Visual/TweenPosition.cs b/Runtime/Actions/Visual/TweenPosition.cs index 8e4d306..87c4438 100644 --- a/Runtime/Actions/Visual/TweenPosition.cs +++ b/Runtime/Actions/Visual/TweenPosition.cs @@ -6,7 +6,7 @@ using Godot; namespace Rokojori { [Tool] - [GlobalClass ] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Tween.svg")] public partial class TweenPosition:SequenceAction { [Export] diff --git a/Runtime/Actions/Visual/TweenScale.cs b/Runtime/Actions/Visual/TweenScale.cs index d52eec3..8caef13 100644 --- a/Runtime/Actions/Visual/TweenScale.cs +++ b/Runtime/Actions/Visual/TweenScale.cs @@ -6,7 +6,7 @@ using Godot; namespace Rokojori { [Tool] - [GlobalClass ] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Tween.svg")] public partial class TweenScale:SequenceAction { [Export] diff --git a/Runtime/Animation/Flash/Flash.cs b/Runtime/Animation/Flash/Flash.cs index 3a9a376..595b9d0 100644 --- a/Runtime/Animation/Flash/Flash.cs +++ b/Runtime/Animation/Flash/Flash.cs @@ -8,7 +8,7 @@ using System.Linq; namespace Rokojori { [Tool] - [GlobalClass] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg")] public partial class Flash:SequenceAction { [Export] diff --git a/Runtime/Animation/Highlight/Highlight.cs b/Runtime/Animation/Highlight/Highlight.cs index 9a665d7..871a4fb 100644 --- a/Runtime/Animation/Highlight/Highlight.cs +++ b/Runtime/Animation/Highlight/Highlight.cs @@ -8,7 +8,7 @@ namespace Rokojori { [Tool] - [GlobalClass] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Highlight.svg")] public partial class Highlight:Action { [Export] diff --git a/Runtime/Animation/Shake/Shake.cs b/Runtime/Animation/Shake/Shake.cs index 9082fad..f711056 100644 --- a/Runtime/Animation/Shake/Shake.cs +++ b/Runtime/Animation/Shake/Shake.cs @@ -8,7 +8,7 @@ using System.Linq; namespace Rokojori { [Tool] - [GlobalClass] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Shake.svg")] public partial class Shake:SequenceAction, Animator { [Export] diff --git a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCamera.cs b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCamera.cs index 8fe25f0..1440679 100644 --- a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCamera.cs +++ b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCamera.cs @@ -24,7 +24,29 @@ namespace Rokojori [Export] public ThirdPersonCameraSettings settings; + // [Export] + // public TimeLine timeLine; + + [Export] + public CharacterController.CharacterUpdateMode updateMode = CharacterController.CharacterUpdateMode.Physics_Process; + public override void _Process( double delta ) + { + if ( CharacterController.CharacterUpdateMode.Process == updateMode ) + { + _ProcessCamera( delta ); + } + } + + public override void _PhysicsProcess( double delta ) + { + if ( CharacterController.CharacterUpdateMode.Physics_Process == updateMode ) + { + _ProcessCamera( delta ); + } + } + + void _ProcessCamera( double gameDelta ) { if ( Engine.IsEditorHint() ) { @@ -37,21 +59,24 @@ namespace Rokojori } + // var tl = TimeLineManager.Ensure( timeLine ); + // var delta = tl.delta; + var delta = (float) gameDelta; var data = settings.GetActiveDeviceData(); - var targetPosition = Smoothing.Apply( settings.targetFollowSmoothing, target.GlobalPosition, (float) delta ); + var targetPosition = Smoothing.Apply( settings.targetFollowSmoothing, target.GlobalPosition, delta ); var yawAxis = Sensors.PolarPowerAxis( data.yawNegativeAxis, data.yawPositiveAxis, 1f, data.yawDeadZone, data.yawPower ); var pitchAxis = Sensors.PolarPowerAxis( data.pitchNegativeAxis, data.pitchPositiveAxis, 1f, data.pitchDeadZone, data.pitchPower ); // this.LogInfo( "YAW:", yawAxis, "PITCH:", pitchAxis ); - yaw += yawAxis * settings.yawSpeed * data.yawSpeed * (float)delta; + yaw += yawAxis * settings.yawSpeed * data.yawSpeed * delta; if ( data.pitchIsRelative ) { - pitch += pitchAxis * settings.relativePitchSpeed * data.relativePitchSpeed * (float)delta; + pitch += pitchAxis * settings.relativePitchSpeed * data.relativePitchSpeed * delta; pitch = Mathf.Clamp( pitch, settings.minPitch, settings.maxPitch ); } else @@ -61,9 +86,9 @@ namespace Rokojori var appliedYaw = yaw; - var smoothedYaw = Smoothing.ApplyDegrees( settings.yawSmoothing, appliedYaw, (float) delta ); + var smoothedYaw = Smoothing.ApplyDegrees( settings.yawSmoothing, appliedYaw, delta ); - var smoothedPitch = Smoothing.Apply( settings.pitchSmoothing, pitch, (float) delta ); + var smoothedPitch = Smoothing.Apply( settings.pitchSmoothing, pitch, delta ); var distance = settings.distanceForPitch.Sample( MathX.NormalizeClamped( pitch, settings.minPitch, settings.maxPitch ) ) * settings.distanceScale; diff --git a/Runtime/GameObjects/GameObject.cs b/Runtime/GameObjects/GameObject.cs new file mode 100644 index 0000000..bc130f5 --- /dev/null +++ b/Runtime/GameObjects/GameObject.cs @@ -0,0 +1,18 @@ + +using System.Diagnostics; +using System.Collections; +using System.Collections.Generic; +using System; +using Godot; +using System.Linq; + + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/GameObject.svg") ] + public partial class GameObject:NodeContainer + { + + } +} \ No newline at end of file diff --git a/Runtime/GameObjects/GameObject.cs.uid b/Runtime/GameObjects/GameObject.cs.uid new file mode 100644 index 0000000..44194c2 --- /dev/null +++ b/Runtime/GameObjects/GameObject.cs.uid @@ -0,0 +1 @@ +uid://1hkbhneuwqvf diff --git a/Runtime/GameObjects/NodeContainer.cs b/Runtime/GameObjects/NodeContainer.cs new file mode 100644 index 0000000..5e04df0 --- /dev/null +++ b/Runtime/GameObjects/NodeContainer.cs @@ -0,0 +1,52 @@ + +using System.Diagnostics; +using System.Collections; +using System.Collections.Generic; +using System; +using Godot; +using System.Linq; + + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/NodeContainer.svg") ] + public partial class NodeContainer:NetworkNode + { + #if TOOLS + + [ExportToolButton( "Enable All Children")] + public Callable enableAllButton => Callable.From( + ()=> + { + this.ForEach( n => n.Enable() ); + } + ); + + [ExportToolButton( "Disable All Children")] + public Callable disableAllButton => Callable.From( + ()=> + { + this.ForEach( n => n.Disable() ); + } + ); + + [ExportToolButton( "Show All Children")] + public Callable showAllButton => Callable.From( + ()=> + { + this.ForEach( n => n.SetVisibility( true ) ); + } + ); + + [ExportToolButton( "Hide All Children")] + public Callable hideAllButton => Callable.From( + ()=> + { + this.ForEach( n => n.SetVisibility( false ) ); + } + ); + + #endif + } +} \ No newline at end of file diff --git a/Runtime/GameObjects/NodeContainer.cs.uid b/Runtime/GameObjects/NodeContainer.cs.uid new file mode 100644 index 0000000..30f9217 --- /dev/null +++ b/Runtime/GameObjects/NodeContainer.cs.uid @@ -0,0 +1 @@ +uid://dhs8hqji5od4j diff --git a/Runtime/Godot/NodeState.cs b/Runtime/Godot/NodeState.cs index 5d63386..22251e3 100644 --- a/Runtime/Godot/NodeState.cs +++ b/Runtime/Godot/NodeState.cs @@ -46,6 +46,11 @@ namespace Rokojori Configure( target, configuration ); } + public static void SetVisibility( this Node target, bool visible ) + { + Configure( target, Trillean.Any, Trillean.Any, Trillean.Any, Trillean.Any, TrilleanLogic.FromBool( visible ), false, Node.ProcessModeEnum.Inherit ); + } + public static void Configure( Node target, Trillean processEnabled, Trillean inputEnabled,Trillean physicsEnabled, diff --git a/Runtime/Godot/Nodes.cs b/Runtime/Godot/Nodes.cs index ae1d8b2..d58151a 100644 --- a/Runtime/Godot/Nodes.cs +++ b/Runtime/Godot/Nodes.cs @@ -773,6 +773,11 @@ namespace Rokojori public static T FindDirectChild( this Node parent, Predicate evaluator ) where T:Node { + if ( parent == null || ! Node.IsInstanceValid( parent ) ) + { + return null; + } + var numChildren = parent.GetChildCount(); for ( int i = 0; i < numChildren; i++ ) diff --git a/Runtime/Interactions/CharacterController/CharacterController.cs b/Runtime/Interactions/CharacterController/CharacterController.cs index 9d44048..8d0ec94 100644 --- a/Runtime/Interactions/CharacterController/CharacterController.cs +++ b/Runtime/Interactions/CharacterController/CharacterController.cs @@ -33,7 +33,6 @@ namespace Rokojori [Export] public Smoothing positionSmoothing; - [Export] public Node3D groundedTransform; @@ -56,8 +55,7 @@ namespace Rokojori ProcessActions( (float) delta ); } - graphics.GlobalPosition = Smoothing.Apply( positionSmoothing, body.GlobalPosition, this.delta ); - graphics.SetGlobalQuaternion( Smoothing.Apply( rotationSmoothing, body.GlobalQuaternion(), this.delta ) ); + if ( body.IsOnFloor() ) @@ -73,6 +71,14 @@ namespace Rokojori // Pose.CopyTo( body, graphics ); } + void SmoothPose( float delta ) + { + var smoothingDelta = delta; + graphics.GlobalPosition = Smoothing.Apply( positionSmoothing, body.GlobalPosition, smoothingDelta ); + graphics.SetGlobalQuaternion( Smoothing.Apply( rotationSmoothing, body.GlobalQuaternion(), smoothingDelta ) ); + + } + void AssignGroundedTransform() { if ( groundedTransform == null ) @@ -118,6 +124,8 @@ namespace Rokojori Action.Trigger( c ); } ); + + SmoothPose( delta ); } } } \ No newline at end of file diff --git a/Runtime/Math/Geometry/Box2.cs b/Runtime/Math/Geometry/Box2.cs index 5a5c21f..d2eb488 100644 --- a/Runtime/Math/Geometry/Box2.cs +++ b/Runtime/Math/Geometry/Box2.cs @@ -30,6 +30,24 @@ namespace Rokojori return new Box2( position - Vector2.One * size / 2f, position + Vector2.One * size / 2f ); } + public static Box2 FromPoints( List p ) + { + var bx = new Box2( p[ 0 ], p[ 1 ] ); + bx.EnsureCorrectness(); + + for ( int i = 2; i < p.Count; i++ ) + { + bx.GrowByPoint( p[ i ] ); + } + + return bx; + } + + public Vector2 ToLocal( Vector2 worldPoint ) + { + return ( worldPoint - min ) / ( max - min ); + } + public Box2() {} diff --git a/Runtime/Procedural/Mesh/MeshGeometry.cs b/Runtime/Procedural/Mesh/MeshGeometry.cs index b89cdaf..1cdaa92 100644 --- a/Runtime/Procedural/Mesh/MeshGeometry.cs +++ b/Runtime/Procedural/Mesh/MeshGeometry.cs @@ -391,11 +391,21 @@ namespace Rokojori ApplyTransform( Math3D.TRS( translation, rotation, scale ), start, length ); } - public void ApplyScale( float scale, int start = 0, int length = -1 ) + public void ApplyScale( float scale, int start = 0, int length = -1 ) { ApplyTransform( Math3D.TRS( Vector3.Zero, Quaternion.Identity, Vector3.One * scale ), start, length ); } + public void ApplyScale( float scale, Vector3 pivot, int start = 0, int length = -1 ) + { + var mat = + Math3D.TRS( pivot, Quaternion.Identity, Vector3.One ) * + Math3D.TRS( Vector3.Zero, Quaternion.Identity, Vector3.One * scale ) * + Math3D.TRS( - pivot, Quaternion.Identity, Vector3.One ); + + ApplyTransform( mat, start, length ); + } + public void ApplyTranslation( Vector3 translation, int start = 0, int length = -1 ) { if ( start < 0 ) @@ -614,7 +624,26 @@ namespace Rokojori return mg; } - + + public static MeshGeometry TriangleFan( List points, Vector3 normal, Func uvGenerator ) + { + var mg = new MeshGeometry(); + var center = Math3D.Center( points ); + var centerUV = uvGenerator( center ); + + for ( int i = 0; i < points.Count; i++ ) + { + var p0 = points[ i ]; + var p1 = points[ ( i + 1 ) % points.Count ]; + var uv0 = uvGenerator( p0 ); + var uv1 = uvGenerator( p1 ); + + mg.AddTriangle( p0, p1, center, normal, normal, normal, uv0, uv1, centerUV ); + } + + return mg; + } + public static MeshGeometry CreateFromUVFunction( Func uv, int uSegments, int vSegments, bool fullUVQuads = false ) { var mg = new MeshGeometry(); diff --git a/Runtime/Rendering/TextureAttributes/AnimateTextureAttributeChannel.cs b/Runtime/Rendering/TextureAttributes/AnimateTextureAttributeChannel.cs new file mode 100644 index 0000000..b6ca2f4 --- /dev/null +++ b/Runtime/Rendering/TextureAttributes/AnimateTextureAttributeChannel.cs @@ -0,0 +1,115 @@ + +using Godot; +using Rokojori; +using System.Collections.Generic; +using System.Reflection.Emit; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class AnimateTextureAttributeChannel:SequenceAction, Animator + { + [Export] + public TextureAttributes textureAttributes; + + [Export] + public int index = 0; + + [Export] + public Curve animationCurve; + + [Export] + public Duration duration; + + [Export] + public TextureAttributes.Channel channel = TextureAttributes.Channel.Red; + + [Export] + public TextureAttributes.OperatorType operatorType = TextureAttributes.OperatorType.Set; + + + [Export] + public bool interruptCurrent = true; + + public void OnAnimatorStart(){} + public void OnAnimatorEnd(){} + public void OnAnimatorCancel(){} + + bool _running = false; + + protected override void _OnTrigger() + { + if ( ! interruptCurrent && _running ) + { + return; + } + + var ta = textureAttributes; + + if ( ta == null ) + { + ta = Unique.Get(); + } + + if ( ta == null ) + { + this.LogInfo( "No attributes found..." ); + return; + } + + var actionID = DispatchStart(); + + _running = true; + + var animationTimeLine = TimeLineManager.Ensure( duration.timeLine ); + var start = animationTimeLine.position; + + AnimationManager.StartAnimation( this, textureAttributes, channel + "" ); + + + TimeLineManager.ScheduleSpanIn( animationTimeLine, 0, duration.GetDurationInSeconds(), + ( span, type )=> + { + if ( actionID == -1 ) + { + return; + } + + if ( ! IsInstanceValid( textureAttributes ) ) + { + DispatchCancelled( actionID ); + actionID = -1; + _running = false; + return; + } + + var timeNow = animationTimeLine.position; + var elapsed = timeNow - start; + + // var index = 0; + + var value = animationCurve.Sample( span.phase ); + + + if ( AnimationManager.IsAnimating( this, textureAttributes, channel + "" ) ) + { + // this.LogInfo( "Index", index, "Value:", value, "Channel:", channel, "Operator:", operatorType ); + ta.SetChannel( index, value, channel, operatorType ); + } + + + if ( type == TimeLineSpanUpdateType.End ) + { + AnimationManager.EndAnimation( this, textureAttributes, channel + "" ); + + DispatchEnd( actionID ); + _running = false; + } + }, + this + ); + + } + } +} \ No newline at end of file diff --git a/Runtime/Rendering/TextureAttributes/AnimateTextureAttributeChannel.cs.uid b/Runtime/Rendering/TextureAttributes/AnimateTextureAttributeChannel.cs.uid new file mode 100644 index 0000000..8f2061c --- /dev/null +++ b/Runtime/Rendering/TextureAttributes/AnimateTextureAttributeChannel.cs.uid @@ -0,0 +1 @@ +uid://cgf0uijj8ulwp diff --git a/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs b/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs index 12c556c..b8b579d 100644 --- a/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs +++ b/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs @@ -2,6 +2,7 @@ using Godot; using Rokojori; using System.Collections.Generic; +using System.Reflection.Emit; namespace Rokojori { @@ -26,6 +27,8 @@ namespace Rokojori protected override void _OnTrigger() { + + var ta = textureAttributes; if ( ta == null ) @@ -39,7 +42,7 @@ namespace Rokojori return; } - // this.LogInfo( "Index", index, "Value:", value, "Channel:", channel ); + // this.LogInfo( "Index", index, "Value:", value, "Channel:", channel, "Operator:", operatorType ); ta.SetChannel( index, value, channel, operatorType ); } } diff --git a/Runtime/Sensors/OnSensor.cs b/Runtime/Sensors/OnSensor.cs index cf64ed4..e167ddb 100644 --- a/Runtime/Sensors/OnSensor.cs +++ b/Runtime/Sensors/OnSensor.cs @@ -7,7 +7,7 @@ namespace Rokojori [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/OnEvent.svg") ] public partial class OnSensor: Node { - [Export] + [Export] public Sensor sensor; [Export] @@ -17,7 +17,23 @@ namespace Rokojori public Action onActive; [Export] - public Action onEnd; + public Action onEnd; + + [Export] + public Action onDouble; + + public enum DoubleMode + { + Auto, + Trigger_OnStart_And_OnDouble, + Trigger_OnDouble_Only + } + + [Export] + public DoubleMode doubleMode = DoubleMode.Auto; + + [Export] + public float doubleDuration = 0.3f; [Export] public bool onlyWhenNotConsumed = true; @@ -33,6 +49,9 @@ namespace Rokojori [Export] public SceneCondition sceneCondition; + float _lastDownTime = 0; + float _lastUpTime = 0; + public override void _Process( double delta ) { if ( sensor == null ) @@ -58,16 +77,49 @@ namespace Rokojori // this.LogInfo( "On Sensor", sensor.value, sensor.isDown ); + var timeNow = Time.GetTicksMsec() / 1000.0f; if ( sensor.isDown ) { - Action.Trigger( onStart ); + var elapsedSinceLast = timeNow - _lastDownTime; + _lastDownTime = timeNow; - if ( consumeEvent && onStart != null ) + var isDouble = elapsedSinceLast < doubleDuration; + + var executesStart = true; + var executesDouble = false; + + if ( isDouble ) { - sensor.Consume(); - return; + executesDouble = true; + + if ( doubleMode == DoubleMode.Trigger_OnDouble_Only || + doubleMode == DoubleMode.Auto && onDouble != null ) + { + executesStart = false; + } } + + if ( executesStart ) + { + Action.Trigger( onStart ); + + if ( consumeEvent && onStart != null ) + { + sensor.Consume(); + } + } + + if ( executesDouble ) + { + Action.Trigger( onDouble ); + + if ( consumeEvent && onDouble != null ) + { + sensor.Consume(); + } + } + } if ( sensor.isHold ) @@ -83,6 +135,7 @@ namespace Rokojori if ( sensor.isUp ) { + _lastUpTime = timeNow; Action.Trigger( onEnd ); if ( consumeEvent && onEnd != null ) diff --git a/Runtime/Shading/Library/Transform.gdshaderinc b/Runtime/Shading/Library/Transform.gdshaderinc index f56231e..ba1e7de 100644 --- a/Runtime/Shading/Library/Transform.gdshaderinc +++ b/Runtime/Shading/Library/Transform.gdshaderinc @@ -139,6 +139,16 @@ vec3 screenToWorld( vec2 screen, float z, mat4 _INV_PROJECTION_MATRIX, mat4 _INV return viewToWorld( view.xyz, _INV_VIEW_MATRIX ); } +vec3 screenToLocal( vec2 screen_point, float z, mat4 _PROJECTION_MATRIX, mat4 _VIEW_MATRIX, mat4 _MODEL_MATRIX ) +{ + vec4 clip = vec4( screen_point * 2.0 - 1.0, z, 1.0 ); + vec4 view4 = inverse( _PROJECTION_MATRIX ) * clip; + view4 /= view4.w; + vec3 view = view4.xyz; + mat4 m = inverse( _VIEW_MATRIX * _MODEL_MATRIX ); + return ( m * vec4( view, 1.0 ) ).xyz; +} + vec2 viewToScreen( vec3 view, mat4 _PROJECTION_MATRIX ) { vec4 clip = viewToClip( view, _PROJECTION_MATRIX ); diff --git a/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs b/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs index 2cc1eb3..ebb3e60 100644 --- a/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs +++ b/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs @@ -46,6 +46,11 @@ namespace Rokojori public Vector2 center => _voronoi2D.cellPoints[ index ]; + public Box2 GetBounds() + { + return Box2.FromPoints( GetBoundaryPositions() ); + } + } diff --git a/Runtime/Time/TimeLines/GameTime.tres b/Runtime/Time/TimeLines/GameTime.tres index 634a120..74ed054 100644 --- a/Runtime/Time/TimeLines/GameTime.tres +++ b/Runtime/Time/TimeLines/GameTime.tres @@ -5,4 +5,3 @@ [resource] script = ExtResource("1_lxe8k") loopEnd = 0.0 -startSpeed = 0.5