-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.InputSystem.Editor; | ||
|
||
namespace Inputter | ||
{ | ||
public class ExtensionProcessorEditor : InputParameterEditor<ExtensionProcessor> | ||
{ | ||
public override void OnGUI() | ||
{ | ||
var style = new GUIStyle | ||
{ | ||
normal = new GUIStyleState | ||
{ | ||
textColor = Color.grey, | ||
}, | ||
fontStyle = FontStyle.Italic, | ||
wordWrap = true, | ||
}; | ||
|
||
EditorGUILayout.LabelField("Note: Action Type must be of Pass Through, in order to work", style); | ||
EditorGUILayout.Space(10f); | ||
|
||
target.sensitivitySpeed = EditorGUILayout.FloatField("Sensitivity Speed", target.sensitivitySpeed); | ||
target.gravitySpeed = EditorGUILayout.FloatField("Gravity Speed", target.gravitySpeed); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "Inputter.Runtime.Editor", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:4cb071ee81692854ab0e0c65eb9ba25e", | ||
"GUID:75469ad4d38634e559750d17036d5f7c" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEngine; | ||
using UnityEditor; | ||
|
||
namespace Inputter.Editor | ||
{ | ||
/// <summary> | ||
/// Adds the given define symbols to PlayerSettings define symbols. | ||
/// Just add your own define symbols to the Symbols property at the below. | ||
/// </summary> | ||
[InitializeOnLoad] | ||
public class Inputter : UnityEditor.Editor | ||
{ | ||
/// <summary> | ||
/// Symbols that will be added to the editor | ||
/// </summary> | ||
public static readonly string[] Symbols = new[] | ||
{ | ||
"INPUTTER" | ||
}; | ||
|
||
/// <summary> | ||
/// Add define symbols as soon as Unity gets done compiling. | ||
/// </summary> | ||
static Inputter() | ||
{ | ||
var definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); | ||
|
||
var allDefines = definesString.Split(';').ToList(); | ||
|
||
allDefines.AddRange(Symbols.Except(allDefines)); | ||
|
||
PlayerSettings.SetScriptingDefineSymbolsForGroup( | ||
EditorUserBuildSettings.selectedBuildTargetGroup, | ||
string.Join(";", allDefines.ToArray())); | ||
} | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 MrRobin | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#if UNITY_EDITOR | ||
using UnityEditor; | ||
#endif | ||
|
||
using UnityEngine; | ||
using UnityEngine.InputSystem; | ||
using UnityEngine.Scripting; | ||
|
||
namespace Inputter | ||
{ | ||
#if UNITY_EDITOR | ||
[InitializeOnLoad] | ||
#endif | ||
[Preserve] | ||
public class ExtensionProcessor: InputProcessor<float> | ||
{ | ||
[Tooltip("Sensitivity Speed")] | ||
public float sensitivitySpeed = 0; | ||
|
||
[Tooltip("Gravity Speed")] | ||
public float gravitySpeed = 0; | ||
|
||
[HideInInspector] | ||
private float previousValue = 0f; | ||
|
||
public override float Process(float value, InputControl control) | ||
{ | ||
if (value == 0) | ||
previousValue = Mathf.MoveTowards(previousValue, 0f, gravitySpeed * Time.unscaledDeltaTime); | ||
|
||
previousValue = Mathf.MoveTowards(previousValue, value, sensitivitySpeed * Time.unscaledDeltaTime); | ||
return previousValue; | ||
} | ||
|
||
#if UNITY_EDITOR | ||
static ExtensionProcessor() => Initialize(); | ||
#endif | ||
|
||
[RuntimeInitializeOnLoadMethod] | ||
static void Initialize() => InputSystem.RegisterProcessor<ExtensionProcessor>(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Inputter.Runtime", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:75469ad4d38634e559750d17036d5f7c" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": true, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.