fixed track and controller working
This commit is contained in:
1 parent
50bc30f292
commit
7561677631
13 files changed
+15341
-7473
No files matched your search
Regular → Executable
+501
-10
@@ -1,13 +1,504 @@
|
||||
using UnityEngine;
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.6.1
|
||||
// from Assets/Resources/ShipInput.inputactions
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
public class ShipInput : MonoBehaviour {
|
||||
public InputAction accelerate;
|
||||
public InputAction decelerate;
|
||||
public InputAction look;
|
||||
public InputAction respawn;
|
||||
public InputAction quit;
|
||||
|
||||
void Start() {
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
||||
public partial class @ShipInput: IInputActionCollection2, IDisposable
|
||||
{
|
||||
public InputActionAsset asset { get; }
|
||||
public @ShipInput()
|
||||
{
|
||||
asset = InputActionAsset.FromJson(@"{
|
||||
""name"": ""ShipInput"",
|
||||
""maps"": [
|
||||
{
|
||||
""name"": ""movement"",
|
||||
""id"": ""f52df5ad-4b20-4a0e-a4c8-bbf76c26b2c5"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""accelerate"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""3d5d2223-bd99-4486-a95d-cefe220e0257"",
|
||||
""expectedControlType"": ""Axis"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""decelerate"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""a27ee77d-59bd-4935-9a7b-961c2da0faf7"",
|
||||
""expectedControlType"": ""Axis"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""strafe"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""d8d4baa2-2812-45af-99f6-eab49bef6b61"",
|
||||
""expectedControlType"": ""Vector2"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""look"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""f705d9c6-7be0-40e0-95ba-990e6892d4dc"",
|
||||
""expectedControlType"": ""Vector2"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""respawn"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""2ced6ae8-aba2-4cd7-882e-6e6473308812"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""quit"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""cea65125-c42e-40e9-bc97-966522e16691"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""5e57f603-6e0e-4288-a67e-57c8a8068092"",
|
||||
""path"": ""<Mouse>/leftButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""accelerate"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""f1ab715c-3909-449b-a5b9-0abc49bf8008"",
|
||||
""path"": ""<Gamepad>/rightTrigger"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""accelerate"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""43eea80c-a658-4eee-b6be-2f0124f2785d"",
|
||||
""path"": ""<Mouse>/rightButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""decelerate"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""72aff4e4-d43a-4865-8ce5-42a26fb8270d"",
|
||||
""path"": ""<Gamepad>/leftTrigger"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""decelerate"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""d8bfc5bc-3673-4825-874c-c42f24765ce6"",
|
||||
""path"": ""<Keyboard>/space"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""respawn"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""7bde4731-2ad0-45f2-9fcf-b8a20a6ee7ac"",
|
||||
""path"": ""<Gamepad>/buttonEast"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""respawn"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""6cb625e2-60f3-49d5-9d12-8265a4aab0a4"",
|
||||
""path"": ""<Gamepad>/buttonSouth"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""respawn"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""b3126289-9c10-4247-9cee-bf97a20f429b"",
|
||||
""path"": ""<Gamepad>/buttonWest"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""respawn"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""c87398b5-3170-4be8-80b3-b6304e61bba4"",
|
||||
""path"": ""<Gamepad>/buttonNorth"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""respawn"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""ff02b06d-2805-46a1-9834-1d3be43bcea3"",
|
||||
""path"": ""<Keyboard>/f10"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""quit"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""6eca2679-7a64-4e8e-ade3-9ad4d7eafa82"",
|
||||
""path"": ""<Gamepad>/leftStick"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""WSAD"",
|
||||
""id"": ""8a7788e1-720b-46ee-8253-ffba334daff6"",
|
||||
""path"": ""2DVector"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""up"",
|
||||
""id"": ""6c646c3c-8579-43a9-95c2-06a56a54d226"",
|
||||
""path"": ""<Keyboard>/w"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""down"",
|
||||
""id"": ""9e73f516-8345-4aea-9c07-04081574d1b9"",
|
||||
""path"": ""<Keyboard>/s"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""left"",
|
||||
""id"": ""923dbff2-8bd5-42e9-814d-63726354fca6"",
|
||||
""path"": ""<Keyboard>/a"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""right"",
|
||||
""id"": ""ae3937ef-d1dc-4556-a171-042fe9bd989f"",
|
||||
""path"": ""<Keyboard>/d"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""Arrows"",
|
||||
""id"": ""71f8d215-e03a-44a6-ac20-ee132c3f202f"",
|
||||
""path"": ""2DVector"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""up"",
|
||||
""id"": ""4f9ff5b2-2e55-4180-9546-6f3c3a334e13"",
|
||||
""path"": ""<Keyboard>/upArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""down"",
|
||||
""id"": ""1f317310-50fe-4c74-8380-0f94b4699fce"",
|
||||
""path"": ""<Keyboard>/downArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""left"",
|
||||
""id"": ""bb65e099-37da-4d59-b52d-39a117595f71"",
|
||||
""path"": ""<Keyboard>/leftArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""right"",
|
||||
""id"": ""fedaa785-c164-459b-8743-09171e6c531d"",
|
||||
""path"": ""<Keyboard>/rightArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""strafe"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""fcff1aee-823d-4930-b94b-265846f4dc30"",
|
||||
""path"": ""<Mouse>/delta"",
|
||||
""interactions"": """",
|
||||
""processors"": ""ScaleVector2(x=0.05,y=0.05)"",
|
||||
""groups"": """",
|
||||
""action"": ""look"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""55976656-0c45-48bc-8c60-bdd71583f463"",
|
||||
""path"": ""<Gamepad>/rightStick"",
|
||||
""interactions"": """",
|
||||
""processors"": ""ScaleVector2(x=0.75,y=0.75)"",
|
||||
""groups"": """",
|
||||
""action"": ""look"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": []
|
||||
}");
|
||||
// movement
|
||||
m_movement = asset.FindActionMap("movement", throwIfNotFound: true);
|
||||
m_movement_accelerate = m_movement.FindAction("accelerate", throwIfNotFound: true);
|
||||
m_movement_decelerate = m_movement.FindAction("decelerate", throwIfNotFound: true);
|
||||
m_movement_strafe = m_movement.FindAction("strafe", throwIfNotFound: true);
|
||||
m_movement_look = m_movement.FindAction("look", throwIfNotFound: true);
|
||||
m_movement_respawn = m_movement.FindAction("respawn", throwIfNotFound: true);
|
||||
m_movement_quit = m_movement.FindAction("quit", throwIfNotFound: true);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEngine.Object.Destroy(asset);
|
||||
}
|
||||
|
||||
public InputBinding? bindingMask
|
||||
{
|
||||
get => asset.bindingMask;
|
||||
set => asset.bindingMask = value;
|
||||
}
|
||||
|
||||
public ReadOnlyArray<InputDevice>? devices
|
||||
{
|
||||
get => asset.devices;
|
||||
set => asset.devices = value;
|
||||
}
|
||||
|
||||
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
|
||||
|
||||
public bool Contains(InputAction action)
|
||||
{
|
||||
return asset.Contains(action);
|
||||
}
|
||||
|
||||
public IEnumerator<InputAction> GetEnumerator()
|
||||
{
|
||||
return asset.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
asset.Enable();
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
{
|
||||
asset.Disable();
|
||||
}
|
||||
|
||||
public IEnumerable<InputBinding> bindings => asset.bindings;
|
||||
|
||||
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
|
||||
{
|
||||
return asset.FindAction(actionNameOrId, throwIfNotFound);
|
||||
}
|
||||
|
||||
public int FindBinding(InputBinding bindingMask, out InputAction action)
|
||||
{
|
||||
return asset.FindBinding(bindingMask, out action);
|
||||
}
|
||||
|
||||
// movement
|
||||
private readonly InputActionMap m_movement;
|
||||
private List<IMovementActions> m_MovementActionsCallbackInterfaces = new List<IMovementActions>();
|
||||
private readonly InputAction m_movement_accelerate;
|
||||
private readonly InputAction m_movement_decelerate;
|
||||
private readonly InputAction m_movement_strafe;
|
||||
private readonly InputAction m_movement_look;
|
||||
private readonly InputAction m_movement_respawn;
|
||||
private readonly InputAction m_movement_quit;
|
||||
public struct MovementActions
|
||||
{
|
||||
private @ShipInput m_Wrapper;
|
||||
public MovementActions(@ShipInput wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @accelerate => m_Wrapper.m_movement_accelerate;
|
||||
public InputAction @decelerate => m_Wrapper.m_movement_decelerate;
|
||||
public InputAction @strafe => m_Wrapper.m_movement_strafe;
|
||||
public InputAction @look => m_Wrapper.m_movement_look;
|
||||
public InputAction @respawn => m_Wrapper.m_movement_respawn;
|
||||
public InputAction @quit => m_Wrapper.m_movement_quit;
|
||||
public InputActionMap Get() { return m_Wrapper.m_movement; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
public bool enabled => Get().enabled;
|
||||
public static implicit operator InputActionMap(MovementActions set) { return set.Get(); }
|
||||
public void AddCallbacks(IMovementActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_MovementActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_MovementActionsCallbackInterfaces.Add(instance);
|
||||
@accelerate.started += instance.OnAccelerate;
|
||||
@accelerate.performed += instance.OnAccelerate;
|
||||
@accelerate.canceled += instance.OnAccelerate;
|
||||
@decelerate.started += instance.OnDecelerate;
|
||||
@decelerate.performed += instance.OnDecelerate;
|
||||
@decelerate.canceled += instance.OnDecelerate;
|
||||
@strafe.started += instance.OnStrafe;
|
||||
@strafe.performed += instance.OnStrafe;
|
||||
@strafe.canceled += instance.OnStrafe;
|
||||
@look.started += instance.OnLook;
|
||||
@look.performed += instance.OnLook;
|
||||
@look.canceled += instance.OnLook;
|
||||
@respawn.started += instance.OnRespawn;
|
||||
@respawn.performed += instance.OnRespawn;
|
||||
@respawn.canceled += instance.OnRespawn;
|
||||
@quit.started += instance.OnQuit;
|
||||
@quit.performed += instance.OnQuit;
|
||||
@quit.canceled += instance.OnQuit;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(IMovementActions instance)
|
||||
{
|
||||
@accelerate.started -= instance.OnAccelerate;
|
||||
@accelerate.performed -= instance.OnAccelerate;
|
||||
@accelerate.canceled -= instance.OnAccelerate;
|
||||
@decelerate.started -= instance.OnDecelerate;
|
||||
@decelerate.performed -= instance.OnDecelerate;
|
||||
@decelerate.canceled -= instance.OnDecelerate;
|
||||
@strafe.started -= instance.OnStrafe;
|
||||
@strafe.performed -= instance.OnStrafe;
|
||||
@strafe.canceled -= instance.OnStrafe;
|
||||
@look.started -= instance.OnLook;
|
||||
@look.performed -= instance.OnLook;
|
||||
@look.canceled -= instance.OnLook;
|
||||
@respawn.started -= instance.OnRespawn;
|
||||
@respawn.performed -= instance.OnRespawn;
|
||||
@respawn.canceled -= instance.OnRespawn;
|
||||
@quit.started -= instance.OnQuit;
|
||||
@quit.performed -= instance.OnQuit;
|
||||
@quit.canceled -= instance.OnQuit;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(IMovementActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_MovementActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
public void SetCallbacks(IMovementActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_MovementActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_MovementActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
public MovementActions @movement => new MovementActions(this);
|
||||
public interface IMovementActions
|
||||
{
|
||||
void OnAccelerate(InputAction.CallbackContext context);
|
||||
void OnDecelerate(InputAction.CallbackContext context);
|
||||
void OnStrafe(InputAction.CallbackContext context);
|
||||
void OnLook(InputAction.CallbackContext context);
|
||||
void OnRespawn(InputAction.CallbackContext context);
|
||||
void OnQuit(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user