commit 524414c1bc8a62d75715abbc474b0c07346c191e parent e57cffc304a322b3538e1590477bb1700e398930 Author: PlutoTank <qwolkensperg@gmail.com> Date: Thu, 16 Apr 2020 21:55:12 -0400 Added input orbitals no smoothing Diffstat:
13 files changed, 145 insertions(+), 80 deletions(-)
diff --git a/Assets/Prefabs/Slimes/Slime.prefab b/Assets/Prefabs/Slimes/Slime.prefab @@ -1188,6 +1188,10 @@ MonoBehaviour: m_Calls: [] m_ActionId: 4769900b-900e-4e04-8ca7-4cd6537ca9d8 m_ActionName: AbilityButtons/JumpAbility[/Keyboard/space] + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 62a768e6-9912-4927-b552-bb7cd666df7c + m_ActionName: SwordButtons/SwordMovement[/Mouse/position] m_NeverAutoSwitchControlSchemes: 0 m_DefaultControlScheme: m_DefaultActionMap: VsGameplay @@ -1210,7 +1214,7 @@ MonoBehaviour: orbitals: - orbital: {fileID: 2311679785310360297, guid: 4e346bd7fa8310847b295522d78bb540, type: 3} - orbitalLogic: {fileID: 11400000, guid: f604a09f73d9b3e4a8d515810e94c6d9, type: 2} + orbitalLogic: {fileID: 11400000, guid: e77fb33472e993c4fbd1004f42fc4ed2, type: 2} sticky: 0 --- !u!82 &1545482344972484104 AudioSource: diff --git a/Assets/Scripts/Slimecing/Dependency/Ellipse.cs b/Assets/Scripts/Slimecing/Dependency/Ellipse.cs @@ -13,9 +13,9 @@ namespace Slimecing.Dependency _yAxis = yAxis; } - public Vector2 EvaluateEllipse(float pos) + public Vector2 EvaluateEllipse(float prog) { - float angle = Mathf.Deg2Rad * 360f * pos; + float angle = Mathf.Deg2Rad * 360f * prog; float x = Mathf.Sin(angle) * _xAxis; float y = Mathf.Cos(angle) * _yAxis; diff --git a/Assets/Scripts/Slimecing/InputSystem/SlimeControls.cs b/Assets/Scripts/Slimecing/InputSystem/SlimeControls.cs @@ -239,6 +239,33 @@ namespace Slimecing.InputSystem ""isPartOfComposite"": false } ] + }, + { + ""name"": ""SwordButtons"", + ""id"": ""10c118b0-623f-4675-b54b-081f6f92f058"", + ""actions"": [ + { + ""name"": ""SwordMovement"", + ""type"": ""Value"", + ""id"": ""62a768e6-9912-4927-b552-bb7cd666df7c"", + ""expectedControlType"": ""Vector2"", + ""processors"": """", + ""interactions"": """" + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""399b431c-036d-4e1c-ba97-02388adf41a7"", + ""path"": ""<Gamepad>/rightStick"", + ""interactions"": """", + ""processors"": ""NormalizeVector2,StickDeadzone"", + ""groups"": ""Gamepad"", + ""action"": ""SwordMovement"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] } ], ""controlSchemes"": [ @@ -284,6 +311,9 @@ namespace Slimecing.InputSystem m_AbilityButtons = asset.FindActionMap("AbilityButtons", throwIfNotFound: true); m_AbilityButtons_DashAbility = m_AbilityButtons.FindAction("DashAbility", throwIfNotFound: true); m_AbilityButtons_JumpAbility = m_AbilityButtons.FindAction("JumpAbility", throwIfNotFound: true); + // SwordButtons + m_SwordButtons = asset.FindActionMap("SwordButtons", throwIfNotFound: true); + m_SwordButtons_SwordMovement = m_SwordButtons.FindAction("SwordMovement", throwIfNotFound: true); } public void Dispose() @@ -329,7 +359,7 @@ namespace Slimecing.InputSystem { asset.Disable(); } - + // VsGameplay private readonly InputActionMap m_VsGameplay; private IVsGameplayActions m_VsGameplayActionsCallbackInterface; @@ -411,6 +441,39 @@ namespace Slimecing.InputSystem } } public AbilityButtonsActions @AbilityButtons => new AbilityButtonsActions(this); + + // SwordButtons + private readonly InputActionMap m_SwordButtons; + private ISwordButtonsActions m_SwordButtonsActionsCallbackInterface; + private readonly InputAction m_SwordButtons_SwordMovement; + public struct SwordButtonsActions + { + private @SlimeControls m_Wrapper; + public SwordButtonsActions(@SlimeControls wrapper) { m_Wrapper = wrapper; } + public InputAction @SwordMovement => m_Wrapper.m_SwordButtons_SwordMovement; + public InputActionMap Get() { return m_Wrapper.m_SwordButtons; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(SwordButtonsActions set) { return set.Get(); } + public void SetCallbacks(ISwordButtonsActions instance) + { + if (m_Wrapper.m_SwordButtonsActionsCallbackInterface != null) + { + @SwordMovement.started -= m_Wrapper.m_SwordButtonsActionsCallbackInterface.OnSwordMovement; + @SwordMovement.performed -= m_Wrapper.m_SwordButtonsActionsCallbackInterface.OnSwordMovement; + @SwordMovement.canceled -= m_Wrapper.m_SwordButtonsActionsCallbackInterface.OnSwordMovement; + } + m_Wrapper.m_SwordButtonsActionsCallbackInterface = instance; + if (instance != null) + { + @SwordMovement.started += instance.OnSwordMovement; + @SwordMovement.performed += instance.OnSwordMovement; + @SwordMovement.canceled += instance.OnSwordMovement; + } + } + } + public SwordButtonsActions @SwordButtons => new SwordButtonsActions(this); private int m_AllControlSchemesSchemeIndex = -1; public InputControlScheme AllControlSchemesScheme { @@ -443,11 +506,14 @@ namespace Slimecing.InputSystem void OnHorizontal(InputAction.CallbackContext context); void OnVertical(InputAction.CallbackContext context); } - public interface IAbilityButtonsActions { void OnDashAbility(InputAction.CallbackContext context); void OnJumpAbility(InputAction.CallbackContext context); } + public interface ISwordButtonsActions + { + void OnSwordMovement(InputAction.CallbackContext context); + } } } diff --git a/Assets/Scripts/Slimecing/InputSystem/SlimeControls.inputactions b/Assets/Scripts/Slimecing/InputSystem/SlimeControls.inputactions @@ -224,6 +224,33 @@ "isPartOfComposite": false } ] + }, + { + "name": "SwordButtons", + "id": "10c118b0-623f-4675-b54b-081f6f92f058", + "actions": [ + { + "name": "SwordMovement", + "type": "Value", + "id": "62a768e6-9912-4927-b552-bb7cd666df7c", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "" + } + ], + "bindings": [ + { + "name": "", + "id": "399b431c-036d-4e1c-ba97-02388adf41a7", + "path": "<Gamepad>/rightStick", + "interactions": "", + "processors": "NormalizeVector2,StickDeadzone", + "groups": "Gamepad", + "action": "SwordMovement", + "isComposite": false, + "isPartOfComposite": false + } + ] } ], "controlSchemes": [ diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalLogic.cs b/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalLogic.cs @@ -36,6 +36,6 @@ namespace Slimecing.Swords.Orbitals public abstract void Initialize(GameObject owner, GameObject orbital); - public virtual void Tick(GameObject owner, GameObject orbital) { } + public abstract void Tick(GameObject owner, GameObject orbital); } } diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalLogicScripts/InputOrbitalLogic.cs.meta b/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalLogicScripts/InputOrbitalLogic.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5d7968acda84baa4fa1a7008b6f01265 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalStats.cs b/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalStats.cs @@ -1,22 +0,0 @@ -using UnityEngine; - -namespace Slimecing.Swords.Orbitals -{ - [CreateAssetMenu(fileName = "OrbitalStats", menuName = "Swords/BasicStats/OrbitalStats")] - public class OrbitalStats : ScriptableObject - { - [SerializeField] private float rotSpeed; - [SerializeField] private float yOffset; - [SerializeField] private float xAxis = 5f; - [SerializeField] private float zAxis = 5f; - - public float RotSpeed => rotSpeed; - - public float YOffset => yOffset; - - public float XAxis => xAxis; - - public float ZAxis => zAxis; - - } -} diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalStats.cs.meta b/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalStats.cs.meta @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 564ce7eed3e9d224daf020ae642e145c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/TakesOrbitals.cs b/Assets/Scripts/Slimecing/Swords/Orbitals/TakesOrbitals.cs @@ -21,11 +21,11 @@ namespace Slimecing.Swords.Orbitals private void SpawnAllOrbitals() { + var thisTransform = transform; for (int i = 0; i < orbitals.Count; i++) { - var thisTransform = transform; GameObject spawnedOrbital = Instantiate(orbitals[i].orbitalObject, thisTransform.position, - Quaternion.identity, thisTransform); + Quaternion.identity); orbitals[i] = new OrbitalPackage(spawnedOrbital, orbitals[i].OrbitalLogic); InitializeOrbital(orbitals[i]); } diff --git a/Assets/Scripts/Slimecing/Triggers/TriggerLogic/AxisInputTrigger.cs b/Assets/Scripts/Slimecing/Triggers/TriggerLogic/AxisInputTrigger.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using UnityEngine.InputSystem; + +namespace Slimecing.Triggers.TriggerLogic +{ + [CreateAssetMenu(fileName = "TwoDimensionalAxisInputTrigger ", menuName = "Triggers/InputTriggers/TwoDimensionalAxisInputTrigger ")] + public class TwoDimensionalAxisInputTrigger : TriggerInput + { + protected override void TriggerStarted(GameObject player, InputAction.CallbackContext ctx) + { + currentTriggerState = TriggerState.Performed; + OnTriggerStateChange(new TriggerPackage(TriggerState.Performed, player, ctx)); + } + + protected override void TriggerPerformed(GameObject player, InputAction.CallbackContext ctx) + { + currentTriggerState = TriggerState.Performed; + OnTriggerStateChange(new TriggerPackage(TriggerState.Performed, player, ctx)); + } + + protected override void TriggerCanceled(GameObject player, InputAction.CallbackContext ctx) + { + currentTriggerState = TriggerState.Canceled; + OnTriggerStateChange(new TriggerPackage(TriggerState.Canceled, player, ctx)); + } + } +} diff --git a/Assets/Scripts/Slimecing/Triggers/TriggerLogic/TwoDimensionalAxisInputTrigger.cs b/Assets/Scripts/Slimecing/Triggers/TriggerLogic/TwoDimensionalAxisInputTrigger.cs @@ -1,26 +0,0 @@ -using UnityEngine; -using UnityEngine.InputSystem; - -namespace Slimecing.Triggers.TriggerLogic -{ - public class TwoDimensionalAxisInputTrigger : TriggerInput - { - protected override void TriggerStarted(GameObject player, InputAction.CallbackContext ctx) - { - currentTriggerState = TriggerState.Performed; - OnTriggerStateChange(new TriggerPackage(TriggerState.Performed, player, ctx)); - } - - protected override void TriggerPerformed(GameObject player, InputAction.CallbackContext ctx) - { - currentTriggerState = TriggerState.Performed; - OnTriggerStateChange(new TriggerPackage(TriggerState.Performed, player, ctx)); - } - - protected override void TriggerCanceled(GameObject player, InputAction.CallbackContext ctx) - { - currentTriggerState = TriggerState.Canceled; - OnTriggerStateChange(new TriggerPackage(TriggerState.Canceled, player, ctx)); - } - } -} diff --git a/Assets/Scripts/Slimecing/Triggers/TriggerLogic/TwoDimensionalAxisInputTrigger.cs.meta b/Assets/Scripts/Slimecing/Triggers/TriggerLogic/TwoDimensionalAxisInputTrigger.cs.meta @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b724fbf88219cb4459211c90795c6464 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Slimecing/Triggers/TriggerPackage.cs b/Assets/Scripts/Slimecing/Triggers/TriggerPackage.cs @@ -8,13 +8,13 @@ namespace Slimecing.Triggers public TriggerState triggerState { get; set; } public GameObject user { get; set; } - public InputAction.CallbackContext? ctx { get; set; } + public InputAction.CallbackContext ctx { get; set; } public TriggerPackage(TriggerState triggerState, GameObject user) { this.triggerState = triggerState; this.user = user; - this.ctx = null; + ctx = new InputAction.CallbackContext(); } public TriggerPackage(TriggerState triggerState, GameObject user, InputAction.CallbackContext ctx) {