merge feat/level/create-level-1 : keep the most recent
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user