// Update is called once per frame //Used for receiving input void Update() { //Input.GetAxisRaw either returns a 0(not moving), 1(right), -1(left) //It is multiplied by playerspeed to get a velocity that either moves left or right if (!isZipping) { playerVelocity = Input.GetAxisRaw("Horizontal") * playerSpeed; climbingVelocity = Input.GetAxisRaw("Vertical") * climbingSpeed; } if (Input.GetButtonDown("Jump")) { hasJumped = true; GetComponent <DistanceJoint2D>().enabled = false; isZipping = false; if (grounded) { anim.SetTrigger("jumping"); } //Debug.Log("Jump start"); //checkJump(); } if (Input.GetButton("Climb")) { isClimbing = true; GetComponent <DistanceJoint2D>().enabled = false; isZipping = false; //checkClimb(); } else { isClimbing = false; } if (!hangingOffWall || !onCorner) { anim.SetBool("climbing", false); } if (!onCeiling) { anim.SetBool("ceilingClimb", false); } if (Input.GetButtonDown("Mask")) { Debug.Log("mask power"); if (maskInventory.Count > 0) { playerMask.maskPower(maskInventory[maskCounter]); } } if (Input.GetButtonDown("LeftToggle")) { if (maskInventory.Count >= 2) { maskCounter--; if (maskCounter < 0) { maskCounter = maskInventory.Count - 1; } Debug.Log("Mask " + maskCounter); Debug.Log("Mask count " + maskInventory.Count); } } if (Input.GetButtonDown("RightToggle")) { if (maskInventory.Count >= 2) { maskCounter++; if (maskCounter >= maskInventory.Count) { maskCounter = 0; } Debug.Log("Mask " + maskCounter); Debug.Log("Mask count " + maskInventory.Count); } } if (maskInventory.Count > 0) { maskController.setMask(maskInventory[maskCounter]); if (maskInventory[maskCounter].Equals("Stamina")) { climb.climbStaminaBuff(); } else { climb.regulateStamina(); } if (maskInventory[maskCounter].Equals("Companion")) { companion.SetActive(true); if (!turtleSpawned) { companion.transform.position = restPoint.transform.position; speech.setSpawn(true); speechBubble.SetActive(true); speech.setSpeech(); } turtleSpawned = true; speechTimer += Time.deltaTime; if (speechTimer > speechChange) { speech.setSpeech(); speechTimer = 0; } } else { companion.SetActive(false); speechBubble.SetActive(false); speech.setSpawn(false); turtleSpawned = false; } } resetKBState(ActivateKBToReset); }