diff --git a/Assets/Scenes/Demos/graybox scene.unity b/Assets/Scenes/Demos/graybox scene.unity index e36d8e5..f036688 100644 --- a/Assets/Scenes/Demos/graybox scene.unity +++ b/Assets/Scenes/Demos/graybox scene.unity @@ -37034,8 +37034,8 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1596573753} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -2058, y: -1221, z: 0} + m_LocalRotation: {x: -0, y: 0.41664216, z: -0, w: 0.9090706} + m_LocalPosition: {x: -231.61304, y: -1166.8, z: 484.46008} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 305860925} @@ -37043,7 +37043,7 @@ Transform: - {fileID: 1744122073} m_Father: {fileID: 1385949117} m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 49.246, z: 0} --- !u!1 &1599740230 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/ControllsGamePadControlls.cs b/Assets/Scripts/ControllsGamePadControlls.cs new file mode 100644 index 0000000..efbf937 --- /dev/null +++ b/Assets/Scripts/ControllsGamePadControlls.cs @@ -0,0 +1,132 @@ +// GENERATED AUTOMATICALLY FROM 'Assets/Scripts/ControllsGamePadControlls.inputactions' + +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.Utilities; + +public class @ControllsGamePadControlls : IInputActionCollection, IDisposable +{ + public InputActionAsset asset { get; } + public @ControllsGamePadControlls() + { + asset = InputActionAsset.FromJson(@"{ + ""name"": ""ControllsGamePadControlls"", + ""maps"": [ + { + ""name"": ""RunnerGamePad"", + ""id"": ""04979d69-e216-469f-817d-0a874e345751"", + ""actions"": [ + { + ""name"": ""Jump"", + ""type"": ""Button"", + ""id"": ""7a804743-c0f5-41cc-af8d-d108aa08c712"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """" + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""8a6737f7-66b7-4bdb-a7f4-822c756a7b53"", + ""path"": ""/buttonSouth"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Jump"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + } + ], + ""controlSchemes"": [] +}"); + // RunnerGamePad + m_RunnerGamePad = asset.FindActionMap("RunnerGamePad", throwIfNotFound: true); + m_RunnerGamePad_Jump = m_RunnerGamePad.FindAction("Jump", throwIfNotFound: true); + } + + public void Dispose() + { + UnityEngine.Object.Destroy(asset); + } + + public InputBinding? bindingMask + { + get => asset.bindingMask; + set => asset.bindingMask = value; + } + + public ReadOnlyArray? devices + { + get => asset.devices; + set => asset.devices = value; + } + + public ReadOnlyArray controlSchemes => asset.controlSchemes; + + public bool Contains(InputAction action) + { + return asset.Contains(action); + } + + public IEnumerator GetEnumerator() + { + return asset.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Enable() + { + asset.Enable(); + } + + public void Disable() + { + asset.Disable(); + } + + // RunnerGamePad + private readonly InputActionMap m_RunnerGamePad; + private IRunnerGamePadActions m_RunnerGamePadActionsCallbackInterface; + private readonly InputAction m_RunnerGamePad_Jump; + public struct RunnerGamePadActions + { + private @ControllsGamePadControlls m_Wrapper; + public RunnerGamePadActions(@ControllsGamePadControlls wrapper) { m_Wrapper = wrapper; } + public InputAction @Jump => m_Wrapper.m_RunnerGamePad_Jump; + public InputActionMap Get() { return m_Wrapper.m_RunnerGamePad; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(RunnerGamePadActions set) { return set.Get(); } + public void SetCallbacks(IRunnerGamePadActions instance) + { + if (m_Wrapper.m_RunnerGamePadActionsCallbackInterface != null) + { + @Jump.started -= m_Wrapper.m_RunnerGamePadActionsCallbackInterface.OnJump; + @Jump.performed -= m_Wrapper.m_RunnerGamePadActionsCallbackInterface.OnJump; + @Jump.canceled -= m_Wrapper.m_RunnerGamePadActionsCallbackInterface.OnJump; + } + m_Wrapper.m_RunnerGamePadActionsCallbackInterface = instance; + if (instance != null) + { + @Jump.started += instance.OnJump; + @Jump.performed += instance.OnJump; + @Jump.canceled += instance.OnJump; + } + } + } + public RunnerGamePadActions @RunnerGamePad => new RunnerGamePadActions(this); + public interface IRunnerGamePadActions + { + void OnJump(InputAction.CallbackContext context); + } +} diff --git a/Assets/Scripts/PlayerScripts/MovementAbilities/ControllerMovement.cs.meta b/Assets/Scripts/ControllsGamePadControlls.cs.meta similarity index 83% rename from Assets/Scripts/PlayerScripts/MovementAbilities/ControllerMovement.cs.meta rename to Assets/Scripts/ControllsGamePadControlls.cs.meta index dc2e82c..a503fd0 100644 --- a/Assets/Scripts/PlayerScripts/MovementAbilities/ControllerMovement.cs.meta +++ b/Assets/Scripts/ControllsGamePadControlls.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5ef694cf61426b340906b3ae381c32b8 +guid: 2fa44697960ae5f41bd367e6d38531ab MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/PlayerScripts/MovementAbilities/ControllerMovement.cs b/Assets/Scripts/PlayerScripts/MovementAbilities/ControllerMovement.cs deleted file mode 100644 index d6e4a9f..0000000 --- a/Assets/Scripts/PlayerScripts/MovementAbilities/ControllerMovement.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - - -public class ControllerMovement : MonoBehaviour -{ - // Start is called before the first frame update - void Start(){ - - - } - - // Update is called once per frame - void Update(){ - - } -} diff --git a/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.cs b/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.cs new file mode 100644 index 0000000..77ce83a --- /dev/null +++ b/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.cs @@ -0,0 +1,132 @@ +// GENERATED AUTOMATICALLY FROM 'Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.inputactions' + +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.Utilities; + +public class @GamePadControlls : IInputActionCollection, IDisposable +{ + public InputActionAsset asset { get; } + public @GamePadControlls() + { + asset = InputActionAsset.FromJson(@"{ + ""name"": ""GamePadControlls"", + ""maps"": [ + { + ""name"": ""Runner"", + ""id"": ""5b72a223-d8e7-4904-bda9-b7bc5bf92850"", + ""actions"": [ + { + ""name"": ""Jump"", + ""type"": ""Button"", + ""id"": ""bd111e05-cd62-4634-ac88-eb948971f528"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """" + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""9fde690f-bb27-4b3c-a7e4-4354283ff9da"", + ""path"": ""/buttonSouth"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Jump"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + } + ], + ""controlSchemes"": [] +}"); + // Runner + m_Runner = asset.FindActionMap("Runner", throwIfNotFound: true); + m_Runner_Jump = m_Runner.FindAction("Jump", throwIfNotFound: true); + } + + public void Dispose() + { + UnityEngine.Object.Destroy(asset); + } + + public InputBinding? bindingMask + { + get => asset.bindingMask; + set => asset.bindingMask = value; + } + + public ReadOnlyArray? devices + { + get => asset.devices; + set => asset.devices = value; + } + + public ReadOnlyArray controlSchemes => asset.controlSchemes; + + public bool Contains(InputAction action) + { + return asset.Contains(action); + } + + public IEnumerator GetEnumerator() + { + return asset.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Enable() + { + asset.Enable(); + } + + public void Disable() + { + asset.Disable(); + } + + // Runner + private readonly InputActionMap m_Runner; + private IRunnerActions m_RunnerActionsCallbackInterface; + private readonly InputAction m_Runner_Jump; + public struct RunnerActions + { + private @GamePadControlls m_Wrapper; + public RunnerActions(@GamePadControlls wrapper) { m_Wrapper = wrapper; } + public InputAction @Jump => m_Wrapper.m_Runner_Jump; + public InputActionMap Get() { return m_Wrapper.m_Runner; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(RunnerActions set) { return set.Get(); } + public void SetCallbacks(IRunnerActions instance) + { + if (m_Wrapper.m_RunnerActionsCallbackInterface != null) + { + @Jump.started -= m_Wrapper.m_RunnerActionsCallbackInterface.OnJump; + @Jump.performed -= m_Wrapper.m_RunnerActionsCallbackInterface.OnJump; + @Jump.canceled -= m_Wrapper.m_RunnerActionsCallbackInterface.OnJump; + } + m_Wrapper.m_RunnerActionsCallbackInterface = instance; + if (instance != null) + { + @Jump.started += instance.OnJump; + @Jump.performed += instance.OnJump; + @Jump.canceled += instance.OnJump; + } + } + } + public RunnerActions @Runner => new RunnerActions(this); + public interface IRunnerActions + { + void OnJump(InputAction.CallbackContext context); + } +} diff --git a/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.cs.meta b/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.cs.meta new file mode 100644 index 0000000..723882b --- /dev/null +++ b/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3698cf5288c74ad41ba892329e2fb719 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.inputactions b/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.inputactions new file mode 100644 index 0000000..eb95162 --- /dev/null +++ b/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.inputactions @@ -0,0 +1,33 @@ +{ + "name": "GamePadControlls", + "maps": [ + { + "name": "Runner", + "id": "5b72a223-d8e7-4904-bda9-b7bc5bf92850", + "actions": [ + { + "name": "Jump", + "type": "Button", + "id": "bd111e05-cd62-4634-ac88-eb948971f528", + "expectedControlType": "Button", + "processors": "", + "interactions": "" + } + ], + "bindings": [ + { + "name": "", + "id": "9fde690f-bb27-4b3c-a7e4-4354283ff9da", + "path": "/buttonSouth", + "interactions": "", + "processors": "", + "groups": "", + "action": "Jump", + "isComposite": false, + "isPartOfComposite": false + } + ] + } + ], + "controlSchemes": [] +} \ No newline at end of file diff --git a/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.inputactions.meta b/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.inputactions.meta new file mode 100644 index 0000000..e2844b9 --- /dev/null +++ b/Assets/Scripts/PlayerScripts/MovementAbilities/GamePadControlls.inputactions.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: c3d6a5f3edd2f9d4693efbb2085dde9c +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} + generateWrapperCode: 1 + wrapperCodePath: + wrapperClassName: + wrapperCodeNamespace: diff --git a/Assets/Scripts/PlayerScripts/PlayerMovement.cs b/Assets/Scripts/PlayerScripts/PlayerMovement.cs index bab2de5..46b9d8f 100644 --- a/Assets/Scripts/PlayerScripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerScripts/PlayerMovement.cs @@ -3,10 +3,12 @@ using System.Collections.Generic; using MLAPI; using UnityEngine; using UnityEngine.UI; +using UnityEngine.InputSystem; public class PlayerMovement : NetworkBehaviour { - + //Controller object + new GamePadControlls controler; //Scripts public PlayerStats pStats; @@ -88,7 +90,10 @@ public class PlayerMovement : NetworkBehaviour capCol = GetComponent(); pStats = GetComponent(); parentObj = transform.parent.gameObject; + controler = new GamePadControlls(); + controler.Runner.Enable(); + Debug.Log(controler.Runner.enabled); //camera transform cam = parentObj.GetComponentInChildren(); @@ -246,7 +251,7 @@ public class PlayerMovement : NetworkBehaviour private void Jump() { //If space is pressed apply an upwards force to the player - if (Input.GetAxis("Jump") != 0 && !jumpPressed && curJumpNum + 1 < pStats.JumpNum && !isSliding) + if ((Input.GetAxis("Jump") != 0) && !jumpPressed && curJumpNum + 1 < pStats.JumpNum && !isSliding) { AddImpact(transform.up, pStats.JumpPow); curJumpNum++; diff --git a/Assets/Scripts/Spin.cs b/Assets/Scripts/Spin.cs index 8a048d3..c876d98 100644 --- a/Assets/Scripts/Spin.cs +++ b/Assets/Scripts/Spin.cs @@ -8,7 +8,7 @@ public class Spin : MonoBehaviour // Start is called before the first frame update void Start() { - + } // Update is called once per frame diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 78d2cdf..3556e75 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -152,7 +152,8 @@ PlayerSettings: resolutionScalingMode: 0 androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 - applicationIdentifier: {} + applicationIdentifier: + Standalone: com.DefaultCompany.TheKingsRace buildNumber: Standalone: 0 iPhone: 0 @@ -681,7 +682,7 @@ PlayerSettings: m_VersionCode: 1 m_VersionName: apiCompatibilityLevel: 6 - activeInputHandler: 0 + activeInputHandler: 2 cloudProjectId: framebufferDepthMemorylessMode: 0 qualitySettingsNames: []