android build

This commit is contained in:
Vova
2024-01-08 08:42:36 +02:00
parent 6ac52e1665
commit 029bb4a7d8
48 changed files with 6435 additions and 26 deletions
+41
View File
@@ -35,6 +35,15 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""Fire"",
""type"": ""Button"",
""id"": ""15426cef-f42f-45e2-96a3-be5ccf4f7c77"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@@ -147,6 +156,28 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""0b8928e8-bac0-49e9-b1bf-c272e35f6f52"",
""path"": ""<Keyboard>/space"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Fire"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""14e658e7-227f-47f6-94ad-fc988b635cb1"",
""path"": ""<Gamepad>/buttonSouth"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Fire"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@@ -156,6 +187,7 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
// Player
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
m_Player_Movement = m_Player.FindAction("Movement", throwIfNotFound: true);
m_Player_Fire = m_Player.FindAction("Fire", throwIfNotFound: true);
}
public void Dispose()
@@ -218,11 +250,13 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
private readonly InputActionMap m_Player;
private List<IPlayerActions> m_PlayerActionsCallbackInterfaces = new List<IPlayerActions>();
private readonly InputAction m_Player_Movement;
private readonly InputAction m_Player_Fire;
public struct PlayerActions
{
private @InputActions m_Wrapper;
public PlayerActions(@InputActions wrapper) { m_Wrapper = wrapper; }
public InputAction @Movement => m_Wrapper.m_Player_Movement;
public InputAction @Fire => m_Wrapper.m_Player_Fire;
public InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@@ -235,6 +269,9 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
@Movement.started += instance.OnMovement;
@Movement.performed += instance.OnMovement;
@Movement.canceled += instance.OnMovement;
@Fire.started += instance.OnFire;
@Fire.performed += instance.OnFire;
@Fire.canceled += instance.OnFire;
}
private void UnregisterCallbacks(IPlayerActions instance)
@@ -242,6 +279,9 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
@Movement.started -= instance.OnMovement;
@Movement.performed -= instance.OnMovement;
@Movement.canceled -= instance.OnMovement;
@Fire.started -= instance.OnFire;
@Fire.performed -= instance.OnFire;
@Fire.canceled -= instance.OnFire;
}
public void RemoveCallbacks(IPlayerActions instance)
@@ -262,5 +302,6 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
public interface IPlayerActions
{
void OnMovement(InputAction.CallbackContext context);
void OnFire(InputAction.CallbackContext context);
}
}
+31
View File
@@ -13,6 +13,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "Fire",
"type": "Button",
"id": "15426cef-f42f-45e2-96a3-be5ccf4f7c77",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
@@ -125,6 +134,28 @@
"action": "Movement",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "0b8928e8-bac0-49e9-b1bf-c272e35f6f52",
"path": "<Keyboard>/space",
"interactions": "",
"processors": "",
"groups": "",
"action": "Fire",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "14e658e7-227f-47f6-94ad-fc988b635cb1",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",
"action": "Fire",
"isComposite": false,
"isPartOfComposite": false
}
]
}
+8 -3
View File
@@ -88,15 +88,20 @@ public class Player : Character
_isHoldingHammer = true;
}
if (Input.GetKeyDown(KeyCode.Space) && !_isFalling)
if (FireButtonPressed() && !_isFalling)
{
if (_hammer == null)
{
_animator.SetTrigger("Body_ThrowHammer");
}
}
var move=_inputActions.Player.Movement.ReadValue<Vector2>();
base.MoveTo(move.x, isAllowVertical? move.y:0);
var move = _inputActions.Player.Movement.ReadValue<Vector2>();
base.MoveTo(move.x, isAllowVertical ? move.y : 0);
}
private bool FireButtonPressed()
{
return _inputActions.Player.Fire.triggered && _inputActions.Player.Fire.ReadValue<float>() > 0;
}
public void ThrowHammerObject()