Resolve merge conflicts using incoming branch

This commit is contained in:
Antoine Papillon
2026-03-16 11:32:15 +01:00
8 changed files with 212 additions and 26 deletions

View File

@@ -25,7 +25,7 @@
"initialStateCheck": true
},
{
"name": "Pickup",
"name": "HeadInteract",
"type": "Button",
"id": "5a0c555a-8fc4-4188-9eed-401eb8f017b5",
"expectedControlType": "",
@@ -504,7 +504,7 @@
{
"name": "",
"id": "05a519b8-f991-4f43-a438-fbe3db38625b",
"path": "<Mouse>/rightButton",
"path": "<Mouse>/leftButton",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
@@ -519,7 +519,7 @@
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Pickup",
"action": "HeadInteract",
"isComposite": false,
"isPartOfComposite": false
},

View File

@@ -34,22 +34,27 @@ public class PlayerHeadController : MonoBehaviour
void Update()
{
if (input.HeadInteractionPressed)
{
InteractHead();
}
if (input.ThrowPressed)
{
ThrowHead();
}
if (input.PickupPressed)
{
TryPickupHead();
}
}
private void ThrowHead()
private void InteractHead()
{
if (!isHoldingHead)
return;
TryPickupHead();
else
DropHead();
}
private void DropHead()
{
animator.SetTrigger("Throw");
isHoldingHead = false;
@@ -63,6 +68,14 @@ public class PlayerHeadController : MonoBehaviour
RigidbodyConstraints.FreezeRotationX |
RigidbodyConstraints.FreezeRotationZ |
RigidbodyConstraints.FreezeRotationY;
}
private void ThrowHead()
{
if (!isHoldingHead)
return;
DropHead();
m_headRigidbody.AddForce(CameraTransform.forward * ThrowForce, ForceMode.Impulse);
}
@@ -94,4 +107,4 @@ public class PlayerHeadController : MonoBehaviour
Head.localPosition = m_headInitialLocalPos;
Head.localRotation = m_headInitialLocalRot;
}
}
}

View File

@@ -1,6 +1,5 @@
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Windows;
public class PlayerInputController : MonoBehaviour
{
@@ -10,8 +9,8 @@ public class PlayerInputController : MonoBehaviour
private InputAction m_lookAction;
private InputAction m_jumpAction;
private InputAction m_throwAction;
private InputAction m_pickupAction;
private InputAction m_shiftAction;
private InputAction m_headInteractAction;
public Vector2 MoveAmount { get; private set; }
public Vector2 LookAmount { get; private set; }
@@ -19,7 +18,7 @@ public class PlayerInputController : MonoBehaviour
public bool JumpPressed { get; private set; }
public bool ShiftPressed { get; private set; }
public bool ThrowPressed { get; private set; }
public bool PickupPressed { get; private set; }
public bool HeadInteractionPressed { get; private set; }
private void Awake()
{
@@ -30,7 +29,7 @@ public class PlayerInputController : MonoBehaviour
m_jumpAction = map.FindAction("Jump");
m_shiftAction = map.FindAction("Shift");
m_throwAction = map.FindAction("Throw");
m_pickupAction = map.FindAction("Pickup");
m_headInteractAction = map.FindAction("HeadInteract");
}
private void OnEnable()
@@ -51,6 +50,6 @@ public class PlayerInputController : MonoBehaviour
ShiftPressed = m_shiftAction.IsPressed();
JumpPressed = m_jumpAction.WasPressedThisFrame();
ThrowPressed = m_throwAction.WasPressedThisFrame();
PickupPressed = m_pickupAction.WasPressedThisFrame();
HeadInteractionPressed = m_headInteractAction.WasPressedThisFrame();
}
}