This can be seen as the initial state of the project after the released demo.
The changes include:
- New ship models
- Singleton manager structure to keep project scaleable in the future
- Managing players, their settings, character choices, statistics, match setups, controls etc. in a separate decoupled scene
- Main menu with transitions to the arena scene
- Beginnings of a custom audio solution
- Logging with Log4Net
It is really a complete overhaul of the projects structure and management.
785 lines
30 KiB
C#
785 lines
30 KiB
C#
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
|
// version 1.6.3
|
|
// from Assets/Input System Settings/InputActionMaps.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 @InputActionMaps: IInputActionCollection2, IDisposable
|
|
{
|
|
public InputActionAsset asset { get; }
|
|
public @InputActionMaps()
|
|
{
|
|
asset = InputActionAsset.FromJson(@"{
|
|
""name"": ""InputActionMaps"",
|
|
""maps"": [
|
|
{
|
|
""name"": ""Player"",
|
|
""id"": ""048b594b-7049-4378-97bf-bf33615ac9a2"",
|
|
""actions"": [
|
|
{
|
|
""name"": ""Thrust"",
|
|
""type"": ""Value"",
|
|
""id"": ""f49115e0-8e49-49d0-86d9-b401b5dc9a7e"",
|
|
""expectedControlType"": ""Axis"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": true
|
|
},
|
|
{
|
|
""name"": ""Steer"",
|
|
""type"": ""Value"",
|
|
""id"": ""b81175da-8d47-46a1-8d25-39d0aad32a7d"",
|
|
""expectedControlType"": ""Axis"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": true
|
|
},
|
|
{
|
|
""name"": ""Reset"",
|
|
""type"": ""Button"",
|
|
""id"": ""6ab0c9d5-b21f-4819-b5c8-ad277a1246c7"",
|
|
""expectedControlType"": ""Button"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": false
|
|
},
|
|
{
|
|
""name"": ""Boost"",
|
|
""type"": ""PassThrough"",
|
|
""id"": ""c8819d8c-8dc4-4eb6-ae07-132d6fffbed4"",
|
|
""expectedControlType"": ""Button"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": false
|
|
}
|
|
],
|
|
""bindings"": [
|
|
{
|
|
""name"": ""ArrowUpDown"",
|
|
""id"": ""a4cf021d-ea53-421e-acc3-5512320a66c6"",
|
|
""path"": ""1DAxis"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""Negative"",
|
|
""id"": ""c57f6563-83fc-4287-947b-517897d60b48"",
|
|
""path"": ""<Keyboard>/downArrow"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 1"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""Positive"",
|
|
""id"": ""887dfb71-2069-4f93-85bf-feb5d766a4e0"",
|
|
""path"": ""<Keyboard>/upArrow"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 1"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""SW"",
|
|
""id"": ""530564dc-8d85-4da2-9dfe-de7226088d53"",
|
|
""path"": ""1DAxis"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""negative"",
|
|
""id"": ""638cd1c8-871c-4144-bc85-fd97073775e3"",
|
|
""path"": ""<Keyboard>/s"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 2"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""positive"",
|
|
""id"": ""41279947-f349-4d74-87f6-0150117546bc"",
|
|
""path"": ""<Keyboard>/w"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 2"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""Triggers"",
|
|
""id"": ""c23f737f-7d0b-44c9-adf2-af79bc907fe5"",
|
|
""path"": ""1DAxis"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""negative"",
|
|
""id"": ""efa56efa-cdbd-4a0c-942d-d9f63f34b41d"",
|
|
""path"": ""<Gamepad>/leftTrigger"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""positive"",
|
|
""id"": ""b09aaa96-ba43-4e88-a893-f68100d60f5d"",
|
|
""path"": ""<Gamepad>/rightTrigger"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""DPAD"",
|
|
""id"": ""553d2d70-1e91-4da5-a081-0d8b5932ed7f"",
|
|
""path"": ""1DAxis"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""negative"",
|
|
""id"": ""6d3b6aec-4165-44ff-b470-0757bf24e204"",
|
|
""path"": ""<Gamepad>/dpad/down"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""positive"",
|
|
""id"": ""ad2cd039-33a1-4217-88a3-a92cbe881eff"",
|
|
""path"": ""<Gamepad>/dpad/up"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""Buttons"",
|
|
""id"": ""c2bb8b7b-6b05-402f-8efd-88ee0b799a0b"",
|
|
""path"": ""1DAxis"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""negative"",
|
|
""id"": ""1f63525a-edbb-407f-9cc0-46c47fb83195"",
|
|
""path"": ""<Gamepad>/buttonWest"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""positive"",
|
|
""id"": ""dea46670-a213-4f87-b233-2da9e13c61d8"",
|
|
""path"": ""<Gamepad>/buttonSouth"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Thrust"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""ArrowLeftRight"",
|
|
""id"": ""9fb0a522-e3c2-4a96-abba-243a4d975417"",
|
|
""path"": ""1DAxis"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Steer"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""negative"",
|
|
""id"": ""8244e67c-862d-4290-81d9-166e37693466"",
|
|
""path"": ""<Keyboard>/leftArrow"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 1"",
|
|
""action"": ""Steer"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""positive"",
|
|
""id"": ""76453859-ad22-4689-8468-2f8f70a0e62f"",
|
|
""path"": ""<Keyboard>/rightArrow"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 1"",
|
|
""action"": ""Steer"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""AD"",
|
|
""id"": ""37147163-13e3-42c9-bd71-b98dd06b17d7"",
|
|
""path"": ""1DAxis"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Steer"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""negative"",
|
|
""id"": ""9ab0d63e-3836-40bf-969a-dd963113eb4b"",
|
|
""path"": ""<Keyboard>/a"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 2"",
|
|
""action"": ""Steer"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""positive"",
|
|
""id"": ""2bb17c0d-1ff6-446d-8963-7e83b44007fe"",
|
|
""path"": ""<Keyboard>/d"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 2"",
|
|
""action"": ""Steer"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""DPAD"",
|
|
""id"": ""2d7e4f88-0f00-440f-a4d9-4ed030ca5aee"",
|
|
""path"": ""1DAxis"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Steer"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""negative"",
|
|
""id"": ""ea165035-cea6-44cb-9cdf-9d004a1c27e8"",
|
|
""path"": ""<Gamepad>/dpad/left"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Steer"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""positive"",
|
|
""id"": ""5a0913b9-2745-49df-9996-df7f530dab22"",
|
|
""path"": ""<Gamepad>/dpad/right"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Steer"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""LeftStickX"",
|
|
""id"": ""42630580-938e-4cab-9747-35f1ea15fc9a"",
|
|
""path"": ""1DAxis"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Steer"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""negative"",
|
|
""id"": ""30818f05-cc2e-42f8-a656-a9237d9ae1ff"",
|
|
""path"": ""<Gamepad>/leftStick/left"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Steer"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""positive"",
|
|
""id"": ""5939b118-47b4-4558-9b18-23d77cc433c1"",
|
|
""path"": ""<Gamepad>/leftStick/right"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Steer"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""8c09092a-7323-4f5c-80df-19bfe90a207c"",
|
|
""path"": ""<Keyboard>/r"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 1;Keyboard 2"",
|
|
""action"": ""Reset"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""b50ff906-5e23-4bd0-b5b7-98aeb46a2284"",
|
|
""path"": ""<Gamepad>/select"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Reset"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""f76aad49-c115-4d72-a860-b674c8489543"",
|
|
""path"": ""<Keyboard>/enter"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 1"",
|
|
""action"": ""Boost"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""90de50d0-0adf-41c0-b8d2-ffd9ff0d55f2"",
|
|
""path"": ""<Keyboard>/shift"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 2"",
|
|
""action"": ""Boost"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""175de4ed-6b10-420d-bc46-5abf4b21486f"",
|
|
""path"": ""<Gamepad>/buttonEast"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Boost"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""a7d544cb-7418-4091-bb4a-5e24cafb4bec"",
|
|
""path"": ""<Gamepad>/leftShoulder"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Boost"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
""name"": ""Meta"",
|
|
""id"": ""a5c1447b-b3fb-4a89-b942-fdf9beb5a79f"",
|
|
""actions"": [
|
|
{
|
|
""name"": ""Start"",
|
|
""type"": ""Button"",
|
|
""id"": ""18797b6b-ee2f-4fde-85c6-b70e831cdf95"",
|
|
""expectedControlType"": ""Button"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": false
|
|
},
|
|
{
|
|
""name"": ""Pause"",
|
|
""type"": ""Button"",
|
|
""id"": ""2cf1215a-a9ec-4bce-8f08-978e08472f6a"",
|
|
""expectedControlType"": ""Button"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": false
|
|
}
|
|
],
|
|
""bindings"": [
|
|
{
|
|
""name"": """",
|
|
""id"": ""5a7b5d2a-ece5-46e0-a265-deb8949f1b47"",
|
|
""path"": ""<Gamepad>/start"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Start"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""3cd0cfc6-4d22-448f-8f55-ce3678def10a"",
|
|
""path"": ""<Keyboard>/enter"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 1;Keyboard 2"",
|
|
""action"": ""Start"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""98e0906e-0a6c-4097-a3f8-4d8640ad4d2a"",
|
|
""path"": ""<Gamepad>/start"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Controller"",
|
|
""action"": ""Pause"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""fa09a433-c040-4da0-8e75-7c8a5f62d4ce"",
|
|
""path"": ""<Keyboard>/escape"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": ""Keyboard 1;Keyboard 2"",
|
|
""action"": ""Pause"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
}
|
|
]
|
|
}
|
|
],
|
|
""controlSchemes"": [
|
|
{
|
|
""name"": ""Controller"",
|
|
""bindingGroup"": ""Controller"",
|
|
""devices"": [
|
|
{
|
|
""devicePath"": ""<Gamepad>"",
|
|
""isOptional"": false,
|
|
""isOR"": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
""name"": ""Keyboard 1"",
|
|
""bindingGroup"": ""Keyboard 1"",
|
|
""devices"": [
|
|
{
|
|
""devicePath"": ""<Keyboard>"",
|
|
""isOptional"": false,
|
|
""isOR"": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
""name"": ""Keyboard 2"",
|
|
""bindingGroup"": ""Keyboard 2"",
|
|
""devices"": [
|
|
{
|
|
""devicePath"": ""<Keyboard>"",
|
|
""isOptional"": false,
|
|
""isOR"": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
""name"": ""New Player"",
|
|
""bindingGroup"": ""New Player"",
|
|
""devices"": []
|
|
}
|
|
]
|
|
}");
|
|
// Player
|
|
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
|
|
m_Player_Thrust = m_Player.FindAction("Thrust", throwIfNotFound: true);
|
|
m_Player_Steer = m_Player.FindAction("Steer", throwIfNotFound: true);
|
|
m_Player_Reset = m_Player.FindAction("Reset", throwIfNotFound: true);
|
|
m_Player_Boost = m_Player.FindAction("Boost", throwIfNotFound: true);
|
|
// Meta
|
|
m_Meta = asset.FindActionMap("Meta", throwIfNotFound: true);
|
|
m_Meta_Start = m_Meta.FindAction("Start", throwIfNotFound: true);
|
|
m_Meta_Pause = m_Meta.FindAction("Pause", 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);
|
|
}
|
|
|
|
// Player
|
|
private readonly InputActionMap m_Player;
|
|
private List<IPlayerActions> m_PlayerActionsCallbackInterfaces = new List<IPlayerActions>();
|
|
private readonly InputAction m_Player_Thrust;
|
|
private readonly InputAction m_Player_Steer;
|
|
private readonly InputAction m_Player_Reset;
|
|
private readonly InputAction m_Player_Boost;
|
|
public struct PlayerActions
|
|
{
|
|
private @InputActionMaps m_Wrapper;
|
|
public PlayerActions(@InputActionMaps wrapper) { m_Wrapper = wrapper; }
|
|
public InputAction @Thrust => m_Wrapper.m_Player_Thrust;
|
|
public InputAction @Steer => m_Wrapper.m_Player_Steer;
|
|
public InputAction @Reset => m_Wrapper.m_Player_Reset;
|
|
public InputAction @Boost => m_Wrapper.m_Player_Boost;
|
|
public InputActionMap Get() { return m_Wrapper.m_Player; }
|
|
public void Enable() { Get().Enable(); }
|
|
public void Disable() { Get().Disable(); }
|
|
public bool enabled => Get().enabled;
|
|
public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
|
|
public void AddCallbacks(IPlayerActions instance)
|
|
{
|
|
if (instance == null || m_Wrapper.m_PlayerActionsCallbackInterfaces.Contains(instance)) return;
|
|
m_Wrapper.m_PlayerActionsCallbackInterfaces.Add(instance);
|
|
@Thrust.started += instance.OnThrust;
|
|
@Thrust.performed += instance.OnThrust;
|
|
@Thrust.canceled += instance.OnThrust;
|
|
@Steer.started += instance.OnSteer;
|
|
@Steer.performed += instance.OnSteer;
|
|
@Steer.canceled += instance.OnSteer;
|
|
@Reset.started += instance.OnReset;
|
|
@Reset.performed += instance.OnReset;
|
|
@Reset.canceled += instance.OnReset;
|
|
@Boost.started += instance.OnBoost;
|
|
@Boost.performed += instance.OnBoost;
|
|
@Boost.canceled += instance.OnBoost;
|
|
}
|
|
|
|
private void UnregisterCallbacks(IPlayerActions instance)
|
|
{
|
|
@Thrust.started -= instance.OnThrust;
|
|
@Thrust.performed -= instance.OnThrust;
|
|
@Thrust.canceled -= instance.OnThrust;
|
|
@Steer.started -= instance.OnSteer;
|
|
@Steer.performed -= instance.OnSteer;
|
|
@Steer.canceled -= instance.OnSteer;
|
|
@Reset.started -= instance.OnReset;
|
|
@Reset.performed -= instance.OnReset;
|
|
@Reset.canceled -= instance.OnReset;
|
|
@Boost.started -= instance.OnBoost;
|
|
@Boost.performed -= instance.OnBoost;
|
|
@Boost.canceled -= instance.OnBoost;
|
|
}
|
|
|
|
public void RemoveCallbacks(IPlayerActions instance)
|
|
{
|
|
if (m_Wrapper.m_PlayerActionsCallbackInterfaces.Remove(instance))
|
|
UnregisterCallbacks(instance);
|
|
}
|
|
|
|
public void SetCallbacks(IPlayerActions instance)
|
|
{
|
|
foreach (var item in m_Wrapper.m_PlayerActionsCallbackInterfaces)
|
|
UnregisterCallbacks(item);
|
|
m_Wrapper.m_PlayerActionsCallbackInterfaces.Clear();
|
|
AddCallbacks(instance);
|
|
}
|
|
}
|
|
public PlayerActions @Player => new PlayerActions(this);
|
|
|
|
// Meta
|
|
private readonly InputActionMap m_Meta;
|
|
private List<IMetaActions> m_MetaActionsCallbackInterfaces = new List<IMetaActions>();
|
|
private readonly InputAction m_Meta_Start;
|
|
private readonly InputAction m_Meta_Pause;
|
|
public struct MetaActions
|
|
{
|
|
private @InputActionMaps m_Wrapper;
|
|
public MetaActions(@InputActionMaps wrapper) { m_Wrapper = wrapper; }
|
|
public InputAction @Start => m_Wrapper.m_Meta_Start;
|
|
public InputAction @Pause => m_Wrapper.m_Meta_Pause;
|
|
public InputActionMap Get() { return m_Wrapper.m_Meta; }
|
|
public void Enable() { Get().Enable(); }
|
|
public void Disable() { Get().Disable(); }
|
|
public bool enabled => Get().enabled;
|
|
public static implicit operator InputActionMap(MetaActions set) { return set.Get(); }
|
|
public void AddCallbacks(IMetaActions instance)
|
|
{
|
|
if (instance == null || m_Wrapper.m_MetaActionsCallbackInterfaces.Contains(instance)) return;
|
|
m_Wrapper.m_MetaActionsCallbackInterfaces.Add(instance);
|
|
@Start.started += instance.OnStart;
|
|
@Start.performed += instance.OnStart;
|
|
@Start.canceled += instance.OnStart;
|
|
@Pause.started += instance.OnPause;
|
|
@Pause.performed += instance.OnPause;
|
|
@Pause.canceled += instance.OnPause;
|
|
}
|
|
|
|
private void UnregisterCallbacks(IMetaActions instance)
|
|
{
|
|
@Start.started -= instance.OnStart;
|
|
@Start.performed -= instance.OnStart;
|
|
@Start.canceled -= instance.OnStart;
|
|
@Pause.started -= instance.OnPause;
|
|
@Pause.performed -= instance.OnPause;
|
|
@Pause.canceled -= instance.OnPause;
|
|
}
|
|
|
|
public void RemoveCallbacks(IMetaActions instance)
|
|
{
|
|
if (m_Wrapper.m_MetaActionsCallbackInterfaces.Remove(instance))
|
|
UnregisterCallbacks(instance);
|
|
}
|
|
|
|
public void SetCallbacks(IMetaActions instance)
|
|
{
|
|
foreach (var item in m_Wrapper.m_MetaActionsCallbackInterfaces)
|
|
UnregisterCallbacks(item);
|
|
m_Wrapper.m_MetaActionsCallbackInterfaces.Clear();
|
|
AddCallbacks(instance);
|
|
}
|
|
}
|
|
public MetaActions @Meta => new MetaActions(this);
|
|
private int m_ControllerSchemeIndex = -1;
|
|
public InputControlScheme ControllerScheme
|
|
{
|
|
get
|
|
{
|
|
if (m_ControllerSchemeIndex == -1) m_ControllerSchemeIndex = asset.FindControlSchemeIndex("Controller");
|
|
return asset.controlSchemes[m_ControllerSchemeIndex];
|
|
}
|
|
}
|
|
private int m_Keyboard1SchemeIndex = -1;
|
|
public InputControlScheme Keyboard1Scheme
|
|
{
|
|
get
|
|
{
|
|
if (m_Keyboard1SchemeIndex == -1) m_Keyboard1SchemeIndex = asset.FindControlSchemeIndex("Keyboard 1");
|
|
return asset.controlSchemes[m_Keyboard1SchemeIndex];
|
|
}
|
|
}
|
|
private int m_Keyboard2SchemeIndex = -1;
|
|
public InputControlScheme Keyboard2Scheme
|
|
{
|
|
get
|
|
{
|
|
if (m_Keyboard2SchemeIndex == -1) m_Keyboard2SchemeIndex = asset.FindControlSchemeIndex("Keyboard 2");
|
|
return asset.controlSchemes[m_Keyboard2SchemeIndex];
|
|
}
|
|
}
|
|
private int m_NewPlayerSchemeIndex = -1;
|
|
public InputControlScheme NewPlayerScheme
|
|
{
|
|
get
|
|
{
|
|
if (m_NewPlayerSchemeIndex == -1) m_NewPlayerSchemeIndex = asset.FindControlSchemeIndex("New Player");
|
|
return asset.controlSchemes[m_NewPlayerSchemeIndex];
|
|
}
|
|
}
|
|
public interface IPlayerActions
|
|
{
|
|
void OnThrust(InputAction.CallbackContext context);
|
|
void OnSteer(InputAction.CallbackContext context);
|
|
void OnReset(InputAction.CallbackContext context);
|
|
void OnBoost(InputAction.CallbackContext context);
|
|
}
|
|
public interface IMetaActions
|
|
{
|
|
void OnStart(InputAction.CallbackContext context);
|
|
void OnPause(InputAction.CallbackContext context);
|
|
}
|
|
}
|