// Update is called once per frame void Update() { bool isBPressed = Input.getButtonDown(m_PlayerIndex, 1); if (isBPressed) { m_InInventory = (isInvAccessable && !m_InInventory) ? true : false; } Ref_InventoryPanel.SetActive(m_InInventory); }
void FixedUpdate() { if (!m_InInventory) { Vector2 direction = new Vector2(Input.getHorizontal(m_PlayerIndex), Input.getVertical(m_PlayerIndex)); m_FacingRotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; if (direction.magnitude > 0) { direction.Normalize(); Ref_PlayerArtwork.rotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, m_FacingRotation - 90)); } m_Rigidbody.velocity = direction * m_MoveSpeedBase * Time.deltaTime; #if Debug || _Debug _RigidSpeed = m_Rigidbody.velocity.magnitude; #endif } }