merge feat/level/create-level-1 : keep the most recent

This commit is contained in:
Pierre Ryssen
2026-03-30 17:23:31 +02:00
44 changed files with 25882 additions and 9954 deletions

View File

@@ -32,6 +32,8 @@ public class WallInteractButton : MonoBehaviour
private Vector3 m_buttonPressedPos;
private bool m_isVisuallyPressed;
public PlayerHeadController headController;
private void Reset()
{
Collider col = GetComponent<Collider>();
@@ -49,7 +51,7 @@ public class WallInteractButton : MonoBehaviour
private void Update()
{
if (m_playerInRange && Keyboard.current != null && Keyboard.current[interactKey].wasPressedThisFrame)
if (!headController.isHoldingHead && m_playerInRange && Keyboard.current != null && Keyboard.current[interactKey].wasPressedThisFrame)
{
TryInteract();
}

View File

@@ -5,10 +5,12 @@ public class PlayerHeadController : MonoBehaviour
public Transform Head;
public Transform CameraTransform;
public float ThrowForce = 10f;
public float PickupDistance = 3f;
public Transform BodyTransform;
public bool isHoldingHead = true;
public float ThrowForce;
public float PickupDistance;
public bool isHoldingHead;
private Rigidbody m_headRigidbody;
@@ -28,8 +30,13 @@ public class PlayerHeadController : MonoBehaviour
{
Cursor.lockState = CursorLockMode.Locked;
m_headInitialLocalPos = Head.localPosition;
m_headInitialLocalRot = Head.localRotation;
Vector3 offset = new Vector3(0f, -0.5f, 0.5f);
m_headInitialLocalPos = BodyTransform.localPosition + offset;
m_headInitialLocalRot = BodyTransform.localRotation;
m_headRigidbody = Head.GetComponent<Rigidbody>();
Head.SetParent(null);
}
void Update()
@@ -55,6 +62,7 @@ public class PlayerHeadController : MonoBehaviour
private void DropHead()
{
Debug.Log("DropHead");
animator.SetTrigger("Throw");
isHoldingHead = false;
@@ -72,6 +80,7 @@ public class PlayerHeadController : MonoBehaviour
private void ThrowHead()
{
Debug.Log("ThrowHead");
if (!isHoldingHead)
return;
@@ -95,6 +104,7 @@ public class PlayerHeadController : MonoBehaviour
private void PickupHead()
{
Debug.Log("PickupHead");
isHoldingHead = true;
if (m_headRigidbody != null)