Feature : Adding the dev room #1
@@ -50,8 +50,9 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
m_moveAction = map.FindAction("Move");
|
m_moveAction = map.FindAction("Move");
|
||||||
m_lookAction = map.FindAction("Look");
|
m_lookAction = map.FindAction("Look");
|
||||||
m_jumpAction = map.FindAction("Jump");
|
m_jumpAction = map.FindAction("Jump");
|
||||||
m_throwAction = map.FindAction("Throw");
|
// Support both old and new action names without breaking the scene setup.
|
||||||
m_pickupAction = map.FindAction("Pickup");
|
m_throwAction = map.FindAction("Throw") ?? map.FindAction("Attack");
|
||||||
|
m_pickupAction = map.FindAction("Pickup") ?? map.FindAction("Interact");
|
||||||
|
|
||||||
m_rigidbody = GetComponent<Rigidbody>();
|
m_rigidbody = GetComponent<Rigidbody>();
|
||||||
animator = GetComponent<Animator>();
|
animator = GetComponent<Animator>();
|
||||||
@@ -76,20 +77,20 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
m_moveAmt = m_moveAction.ReadValue<Vector2>();
|
m_moveAmt = m_moveAction != null ? m_moveAction.ReadValue<Vector2>() : Vector2.zero;
|
||||||
m_lookAmt = m_lookAction.ReadValue<Vector2>();
|
m_lookAmt = m_lookAction != null ? m_lookAction.ReadValue<Vector2>() : Vector2.zero;
|
||||||
|
|
||||||
if (m_jumpAction.WasPressedThisFrame())
|
if (m_jumpAction != null && m_jumpAction.WasPressedThisFrame())
|
||||||
{
|
{
|
||||||
Jump();
|
Jump();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_throwAction.WasPressedThisFrame())
|
if (m_throwAction != null && m_throwAction.WasPressedThisFrame())
|
||||||
{
|
{
|
||||||
ThrowHead();
|
ThrowHead();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pickupAction.WasPressedThisFrame())
|
if (m_pickupAction != null && (m_pickupAction.WasPressedThisFrame() || m_pickupAction.WasPerformedThisFrame()))
|
||||||
{
|
{
|
||||||
TryPickupHead();
|
TryPickupHead();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user