private void CalculateMovementVector() { m_movementVector.x = 0; m_movementVector.y = 0; if (Input.GetKeyDown(m_movementUpKey)) { m_movementVector += Vector2.up; } if (Input.GetKeyDown(m_movementLeftKey)) { m_movementVector += Vector2.left; } if (Input.GetKeyDown(m_movementDownKey)) { m_movementVector += Vector2.down; } if (Input.GetKeyDown(m_movementRightKey)) { m_movementVector += Vector2.right; } m_movementVector.Normalize(); if (m_movementVector.magnitude > 0.2f) { OnMovementVectorCalculated?.Invoke(m_movementVector); } }
private void CalculateMovementVector() { CalculateVector(); if (m_moveVector.magnitude < 0.2f) { return; } OnMovementVectorCalculated?.Invoke(m_moveVector); }
private void CalculateMovementVector() { Vector2 movementVec = CalculateRawAxisMovement(); movementVec.Normalize(); if (movementVec.magnitude > INPUT_DEADZONE) { OnMovementVectorCalculated?.Invoke(movementVec); } }