// Update is called once per frame void Update() { ///////////////////////////////// //////////////////////////////// //Players ray holder rotates as well if (!RCC.attachTop && !RCC.attachBottom) { if (RCC.attachRight && !hasTurned) { RCC.TurnRight(); StartCoroutine(RotateRight()); } if (RCC.attachLeft && !hasTurned) { RCC.TurnLeft(); StartCoroutine(RotateLeft()); } } }
// Update is called once per frame void Update() { //////////////////////////////// //rotates the level depending on how high the player is from the floor when they hit the wall if (Mathf.Abs(GroundLevel.transform.position.y - ThePlayer.transform.position.y) > 13.5) { print("big"); if (!RCC.attachTop && !RCC.attachBottom) { if (RCC.attachRight && !hasTurned && !isTurningRight) { ChangeCounter(true); RCC.TurnRight(); StartCoroutine(RotateRight()); } if (RCC.attachLeft && !hasTurned && !isTurningLeft) { ChangeCounter(false); RCC.TurnLeft(); StartCoroutine(RotateLeft()); } } } else { print("small"); if (!RCC.attachTop && !RCC.attachBottom) { if (RCC.attachRight && !hasTurned) { BouncePlayer(true); StartCoroutine(RotateRightSmall()); } if (RCC.attachLeft && !hasTurned) { BouncePlayer(false); StartCoroutine(RotateLeftSmall()); } } } if (!isTurningRight && !isTurningLeft) { //Uncomment to jump off roof if (RCC.attachBottom || RCC.attachBottomAny /*|| RCC.attachTopAny||RCC.attachTop*/) { ThePlayer.GetComponent <Character> ().canJump = true; } } //makes sure the player stays in the right position /*if((!isTurningRight || !isTurningLeft ) && rb.velocity== Vector2.zero) * { * * RCC.pnce.Char.isImmobile = false; * //caThePlayer.transform.localPosition = RCC.pnce.lastPos; * * }*/ }