Files
CarTest/Assets/Input/InputMaster.cs

395 lines
14 KiB
C#

//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.6.1
// from Assets/Input/InputMaster.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public partial class @InputMaster: IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @InputMaster()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""InputMaster"",
""maps"": [
{
""name"": ""Car"",
""id"": ""279efb2e-a9ae-40e7-af18-b556d8e58b59"",
""actions"": [
{
""name"": ""Movement"",
""type"": ""Button"",
""id"": ""30aae96b-847c-40a0-aff6-3f1951d55ca3"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Turn"",
""type"": ""Button"",
""id"": ""0be415b5-08e4-453d-9e28-fb9b7eff7e38"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Brake"",
""type"": ""Button"",
""id"": ""190563e6-0fc1-4263-9f0e-919667264461"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
{
""name"": ""Z"",
""id"": ""8c181f14-d941-40de-b32a-0d2bd55fa6f8"",
""path"": ""1DAxis"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Movement"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""93df6b39-9305-4203-bd02-1528711041d5"",
""path"": ""<Gamepad>/leftTrigger"",
""interactions"": """",
""processors"": """",
""groups"": ""Gamepad"",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""74248671-ae82-4fb8-9b1e-7c716d7a918a"",
""path"": ""<Gamepad>/rightTrigger"",
""interactions"": """",
""processors"": """",
""groups"": ""Gamepad"",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""Z"",
""id"": ""3f962054-2147-4969-a731-b2aed5c280d2"",
""path"": ""1DAxis"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Movement"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""5806e9c3-6fff-4468-9777-fa799e5356cd"",
""path"": ""<Keyboard>/downArrow"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard"",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""bd366aea-6bef-4aa2-8ec9-98e0564017a2"",
""path"": ""<Keyboard>/upArrow"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard"",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""X"",
""id"": ""449c5b18-ec83-4072-813e-bebae2c84785"",
""path"": ""1DAxis"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Turn"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""dd9f85b5-dd05-49f4-a0be-22d4e0f1d9fc"",
""path"": ""<Gamepad>/leftStick/left"",
""interactions"": """",
""processors"": """",
""groups"": ""Gamepad"",
""action"": ""Turn"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""aa7bd576-99ff-4b74-b023-f25395d6ad9e"",
""path"": ""<Gamepad>/leftStick/right"",
""interactions"": """",
""processors"": """",
""groups"": ""Gamepad"",
""action"": ""Turn"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""X"",
""id"": ""b0942bad-1a51-4bd7-9fce-a0d408272cc8"",
""path"": ""1DAxis"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Turn"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""72cf4953-8c6b-4bce-8216-9b994421aef2"",
""path"": ""<Keyboard>/leftArrow"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard"",
""action"": ""Turn"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""5532b214-24f7-4e1e-aa5f-b9e20c7b0ae4"",
""path"": ""<Keyboard>/rightArrow"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard"",
""action"": ""Turn"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""5bd100b8-204f-41d9-8870-2df4129bb4c3"",
""path"": ""<Keyboard>/space"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard"",
""action"": ""Brake"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""1759b642-aa43-4fa3-a5d2-ab4356b087a6"",
""path"": ""<Gamepad>/buttonEast"",
""interactions"": """",
""processors"": """",
""groups"": ""Gamepad"",
""action"": ""Brake"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": [
{
""name"": ""Gamepad"",
""bindingGroup"": ""Gamepad"",
""devices"": [
{
""devicePath"": ""<DualShockGamepad>"",
""isOptional"": false,
""isOR"": false
},
{
""devicePath"": ""<XInputController>"",
""isOptional"": false,
""isOR"": false
}
]
},
{
""name"": ""Keyboard"",
""bindingGroup"": ""Keyboard"",
""devices"": [
{
""devicePath"": ""<Keyboard>"",
""isOptional"": false,
""isOR"": false
}
]
}
]
}");
// Car
m_Car = asset.FindActionMap("Car", throwIfNotFound: true);
m_Car_Movement = m_Car.FindAction("Movement", throwIfNotFound: true);
m_Car_Turn = m_Car.FindAction("Turn", throwIfNotFound: true);
m_Car_Brake = m_Car.FindAction("Brake", 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);
}
// Car
private readonly InputActionMap m_Car;
private List<ICarActions> m_CarActionsCallbackInterfaces = new List<ICarActions>();
private readonly InputAction m_Car_Movement;
private readonly InputAction m_Car_Turn;
private readonly InputAction m_Car_Brake;
public struct CarActions
{
private @InputMaster m_Wrapper;
public CarActions(@InputMaster wrapper) { m_Wrapper = wrapper; }
public InputAction @Movement => m_Wrapper.m_Car_Movement;
public InputAction @Turn => m_Wrapper.m_Car_Turn;
public InputAction @Brake => m_Wrapper.m_Car_Brake;
public InputActionMap Get() { return m_Wrapper.m_Car; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(CarActions set) { return set.Get(); }
public void AddCallbacks(ICarActions instance)
{
if (instance == null || m_Wrapper.m_CarActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_CarActionsCallbackInterfaces.Add(instance);
@Movement.started += instance.OnMovement;
@Movement.performed += instance.OnMovement;
@Movement.canceled += instance.OnMovement;
@Turn.started += instance.OnTurn;
@Turn.performed += instance.OnTurn;
@Turn.canceled += instance.OnTurn;
@Brake.started += instance.OnBrake;
@Brake.performed += instance.OnBrake;
@Brake.canceled += instance.OnBrake;
}
private void UnregisterCallbacks(ICarActions instance)
{
@Movement.started -= instance.OnMovement;
@Movement.performed -= instance.OnMovement;
@Movement.canceled -= instance.OnMovement;
@Turn.started -= instance.OnTurn;
@Turn.performed -= instance.OnTurn;
@Turn.canceled -= instance.OnTurn;
@Brake.started -= instance.OnBrake;
@Brake.performed -= instance.OnBrake;
@Brake.canceled -= instance.OnBrake;
}
public void RemoveCallbacks(ICarActions instance)
{
if (m_Wrapper.m_CarActionsCallbackInterfaces.Remove(instance))
UnregisterCallbacks(instance);
}
public void SetCallbacks(ICarActions instance)
{
foreach (var item in m_Wrapper.m_CarActionsCallbackInterfaces)
UnregisterCallbacks(item);
m_Wrapper.m_CarActionsCallbackInterfaces.Clear();
AddCallbacks(instance);
}
}
public CarActions @Car => new CarActions(this);
private int m_GamepadSchemeIndex = -1;
public InputControlScheme GamepadScheme
{
get
{
if (m_GamepadSchemeIndex == -1) m_GamepadSchemeIndex = asset.FindControlSchemeIndex("Gamepad");
return asset.controlSchemes[m_GamepadSchemeIndex];
}
}
private int m_KeyboardSchemeIndex = -1;
public InputControlScheme KeyboardScheme
{
get
{
if (m_KeyboardSchemeIndex == -1) m_KeyboardSchemeIndex = asset.FindControlSchemeIndex("Keyboard");
return asset.controlSchemes[m_KeyboardSchemeIndex];
}
}
public interface ICarActions
{
void OnMovement(InputAction.CallbackContext context);
void OnTurn(InputAction.CallbackContext context);
void OnBrake(InputAction.CallbackContext context);
}
}