/// <summary> /// Move the player /// </summary> private void ProcessInput() { // Process jump, check jump again just in case if ((jump || (player.GetButtonDown("Jump") && grounded)) && haveBox == false && !gameManager.tutUnpausing) { Vector3 yVel = new Vector3(rb.velocity.x, 0, rb.velocity.z); rb.velocity = yVel + Vector3.up * jumpSpeed; midJump = true; // Play jump sound audioManager.PlayJump(playerId); if (jumpParticles) { jumpParticles.Play(); } } // Process movement if (thrown && canMove) { // decreased input when in the air moveVector = rb.velocity; //Debug.Log("Thrown"); Debug.Log(transform.rotation); } // Apply velocity to the rigidbody here moveVector.y = rb.velocity.y; //if(rope.CalculateLength() > rope.RestLength) //{ //Debug.Log("Rope"); //} if ((baby.ropeChanging || grandma.ropeChanging || rope.CalculateLength() > rope.RestLength) && !grounded && !thrown && !midJump) { // Do nothing to the velocity, the baby is being pulled in the air //Debug.Log("What"); } else { if (canMove) { rb.velocity = moveVector; } else { rb.velocity = new Vector3(0, rb.velocity.y, 0); } } if (haveBox && playerId == 1) { rb.velocity = new Vector3(0, rb.velocity.y, 0); } // Process rotation if ((moveVector.x != 0 || moveVector.z != 0) && allowRotate) { float z_angle = Mathf.Atan2(movementDir.x, movementDir.z) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(new Vector3(0, z_angle, 0)); } // Process pick up box or baby if (player.GetButtonDown("Pick") || (player.GetButtonUp("Pick") && (haveBox || haveBbcat))) { grab = true; } else { grab = false; } // Check m_TutorialPause state // To avoid confliction of two actions if (grab && !bePicked && !gameManager.GetTutorialPause()) { pickupCont.PickupPressed(); } // Process drop baby cat, both can drop if (player.GetButtonDown("Drop")) { gmaPickupCont.Drop(); } // Process baby meow meow = player.GetButtonDown("Meow"); if (meow) { meowSound.Play(); } if (restart) { gameManager.RestartLevel(); } }