mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:07:38 +02:00
JoyShockLibrary (#213)
Fix PlayerInput.cs errors on MacOS Fix libraries not being added to the final build
This commit is contained in:
BIN
Assets/Scripts/.DS_Store
vendored
Normal file
BIN
Assets/Scripts/.DS_Store
vendored
Normal file
Binary file not shown.
@ -87,6 +87,17 @@ namespace HeavenStudio
|
||||
|
||||
public static InputController GetInputController(int player)
|
||||
{
|
||||
// Needed so Keyboard works on MacOS
|
||||
#if UNITY_EDITOR_OSX
|
||||
inputDevices = new List<InputController>();
|
||||
if(inputDevices.Count < 1)
|
||||
{
|
||||
InputKeyboard keyboard = new InputKeyboard();
|
||||
keyboard.SetPlayer(1);
|
||||
keyboard.InitializeController();
|
||||
inputDevices.Add(keyboard);
|
||||
}
|
||||
#endif
|
||||
//select input controller that has player field set to player
|
||||
//this will return the first controller that has that player number in the case of controller pairs (eg. Joy-Cons)
|
||||
//so such controllers should have a reference to the other controller in the pair
|
||||
@ -106,6 +117,19 @@ namespace HeavenStudio
|
||||
//this will return the first controller that has that player number in the case of controller pairs (eg. Joy-Cons)
|
||||
//so such controllers should have a reference to the other controller in the pair
|
||||
//controller IDs are determined by connection order (the Keyboard is always first)
|
||||
|
||||
|
||||
// Needed so Keyboard works on MacOS
|
||||
#if UNITY_EDITOR_OSX
|
||||
inputDevices = new List<InputController>();
|
||||
if(inputDevices.Count < 1)
|
||||
{
|
||||
InputKeyboard keyboard = new InputKeyboard();
|
||||
keyboard.SetPlayer(1);
|
||||
keyboard.InitializeController();
|
||||
inputDevices.Add(keyboard);
|
||||
}
|
||||
#endif
|
||||
for (int i = 0; i < inputDevices.Count; i++)
|
||||
{
|
||||
if (inputDevices[i].GetPlayer() == player)
|
||||
@ -118,6 +142,17 @@ namespace HeavenStudio
|
||||
|
||||
public static void UpdateInputControllers()
|
||||
{
|
||||
// Needed so Keyboard works on MacOS
|
||||
#if UNITY_EDITOR_OSX
|
||||
inputDevices = new List<InputController>();
|
||||
if(inputDevices.Count < 1)
|
||||
{
|
||||
InputKeyboard keyboard = new InputKeyboard();
|
||||
keyboard.SetPlayer(1);
|
||||
keyboard.InitializeController();
|
||||
inputDevices.Add(keyboard);
|
||||
}
|
||||
#endif
|
||||
foreach (InputController i in inputDevices)
|
||||
{
|
||||
i.UpdateState();
|
||||
@ -244,4 +279,4 @@ namespace HeavenStudio
|
||||
return GetInputController(1).GetHatDirectionUp((InputController.InputDirection) direction) && playerHasControl();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user