diff --git a/Assets/OkapiKit/Scripts/Editor/TriggerOnInputEditor.cs b/Assets/OkapiKit/Scripts/Editor/TriggerOnInputEditor.cs index fbcccf5..38ee1c4 100644 --- a/Assets/OkapiKit/Scripts/Editor/TriggerOnInputEditor.cs +++ b/Assets/OkapiKit/Scripts/Editor/TriggerOnInputEditor.cs @@ -70,7 +70,7 @@ public override void OnInspectorGUI() { actionsName = "Actions while pressed"; elseActionsName = "Actions while released"; - } + } } else if (inputType == TriggerOnInput.InputType.Key) { @@ -88,6 +88,10 @@ public override void OnInspectorGUI() EditorGUILayout.PropertyField(propAxis, new GUIContent("Axis", "Axis")); EditorGUILayout.PropertyField(propDeadArea, new GUIContent("Dead Area", "How far from center does the axis have to go for it to execute this trigger?")); } + else if (inputType == TriggerOnInput.InputType.AnyKey) + { + EditorGUILayout.PropertyField(propContinuous, new GUIContent("Continuous", "If active, this triggers while any key is pressed, if not this trigger only executes when a key is just pressed.")); + } if ((propContinuous.boolValue) || (inputType == TriggerOnInput.InputType.Axis)) { EditorGUILayout.PropertyField(propNegate, new GUIContent("Negate", "Do we want to trigger this when the input DOESN'T happen, instead of the other way around?")); diff --git a/Assets/OkapiKit/Scripts/Triggers/TriggerOnInput.cs b/Assets/OkapiKit/Scripts/Triggers/TriggerOnInput.cs index 63abfe1..8254d04 100644 --- a/Assets/OkapiKit/Scripts/Triggers/TriggerOnInput.cs +++ b/Assets/OkapiKit/Scripts/Triggers/TriggerOnInput.cs @@ -9,7 +9,7 @@ namespace OkapiKit [AddComponentMenu("Okapi/Trigger/On Input")] public class TriggerOnInput : Trigger { - public enum InputType { Button = 0, Key = 1, Axis = 2 }; + public enum InputType { Button = 0, Key = 1, Axis = 2, AnyKey = 3 }; [SerializeField] InputType inputType = InputType.Button; @@ -33,6 +33,7 @@ public enum InputType { Button = 0, Key = 1, Axis = 2 }; protected ActionTrigger[] elseActions; float cooldownTimer = 0.0f; + bool prevAnyKey = false; public override string GetTriggerTitle() => "On Input"; @@ -41,10 +42,15 @@ public override string GetRawDescription(string ident, GameObject refObject) string desc = "When "; if (inputType == InputType.Button) desc += $"button {buttonName} "; else if (inputType == InputType.Key) desc += $"key {key} "; - else + else if (inputType == InputType.Axis) { desc += $"axis {axis} "; } + else + { + desc += $"any key "; + } + if (continuous) { if (negate) desc += "is not held"; @@ -110,6 +116,20 @@ void Update() elseTrigger = !isTrigger; c = true; } + else if (inputType == InputType.AnyKey) + { + if (continuous) + { + isTrigger = Input.anyKey; + elseTrigger = !Input.anyKey; + } + else + { + isTrigger = Input.anyKeyDown; + elseTrigger = !Input.anyKey && prevAnyKey; + } + prevAnyKey = Input.anyKey; + } if ((c) && (negate)) { diff --git a/Assets/OkapiKit/package.json b/Assets/OkapiKit/package.json index b3fbbca..97453cf 100644 --- a/Assets/OkapiKit/package.json +++ b/Assets/OkapiKit/package.json @@ -1,7 +1,7 @@ { "name": "com.videojogoslusofona.okapikit", "displayName": "OkapiKit", - "version": "1.14.1", + "version": "1.15.0", "unity": "2022.3", "description": "OkapiKit is a toolkit for creation of simple games without code.", "keywords": [ "kit" ], diff --git a/Assets/OkapiKitSamples/package.json b/Assets/OkapiKitSamples/package.json index 1dda79f..451bf27 100644 --- a/Assets/OkapiKitSamples/package.json +++ b/Assets/OkapiKitSamples/package.json @@ -1,14 +1,14 @@ { "name": "com.videojogoslusofona.okapikit.samples", "displayName": "OkapiKit Samples", - "version": "1.14.1", + "version": "1.15.0", "unity": "2022.3", "description": "OkapiKit is a toolkit for creation of simple games without code. This package is just the samples for OkapiKit, they are not required to use Okapi Kit, and requires the Okapi Kit package.", "keywords": [ "okapi", "samples" ], "category": "samples", "dependencies": {}, "relatedPackages": { - "com.videojogoslusofona.okapikit": "1.14.1" + "com.videojogoslusofona.okapikit": "1.15.0" }, "author": { "name": "Videojogos ULHT", diff --git a/README.md b/README.md index 816a7a9..6a82e97 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,7 @@ cursor on top of the Trigger icon (blue dot) on the Player object and we can see [Master484]:http://m484games.ucoz.com/ [Warspawn]:https://opengameart.org/users/warspawn [pansapiens]:https://opengameart.org/users/pansapiens +[rileygombart]:https://opengameart.org/users/rileygombart [chabull]:https://opengameart.org/users/chabull [IMakeGames]:http://www.imake-games.com/ [Winternaut]:https://opengameart.org/users/winternaut diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 6146884..728616f 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,5 +1,9 @@ # Release Notes +## V1.15.0 + +- Added "any key" option to OnInput trigger + ## V1.14.1 - Fixed issue with builds in version V1.14.0 diff --git a/Todo.txt b/Todo.txt index cd37683..a940558 100644 --- a/Todo.txt +++ b/Todo.txt @@ -23,6 +23,8 @@ Features: - Add insert point option for path - Comment Code - Documentation +- Support for Analytics (extra package?) +- Add OnDestroy event Usability: ---------- @@ -34,6 +36,7 @@ Usability: - Add node ID property to actions/triggers - Remove Naughty Attributes completely (reduce dependencies) - On single-line OkapiValue, add a "Value" label to the edit boxes, so we can increase/decrease value by dragging +- Disable hierarchy icons on OkapiConfig Simple usage: -------------