private void Update() { GetAxisDirection(); if (Input.GetKey(KeyCode.Space)) { _jumpManager.Jump(); } _moveManager.Move(GetAxisDirection()); _playerRotateManager.Rotate(-Input.GetAxis("Mouse X")); _cameraRotateManager.Rotate(-Input.GetAxis("Mouse Y")); }
private IEnumerator Point(int positionX, int positionY, bool firstJump) { if (positionX != -1 && positionX != 8 && positionY != -1 && positionY != 8) { if (board[positionX, positionY] == 3) { if (firstJump) { turns.OutlineUpdate(); } board[positionX, positionY] = 0; Destroy(tokenRegistry[positionX, positionY]); GameObject token4 = Instantiate(Token4, new Vector3(positionX, 0.1f, -positionY + 4), Quaternion.identity); float waitTime = 0.20f; if (firstJump) { waitTime = 0.35f; } yield return(new WaitForSeconds(waitTime)); Destroy(token4); source.clip = explosionSound; source.Play(); jump.Jump(positionX, positionY); // Wait for jump animation to end yield return(new WaitForSeconds(0.9f)); bool right, left, down, up; right = left = down = up = false; // Check surrounding tokens if (positionX != 7) { right = CheckPoints(positionX + 1, positionY); } if (positionX != 0) { left = CheckPoints(positionX - 1, positionY); } if (positionY != 7) { down = CheckPoints(positionX, positionY + 1); } if (positionY != 0) { up = CheckPoints(positionX, positionY - 1); } if (right) { yield return(StartCoroutine(Point(positionX + 1, positionY, false))); } if (left) { yield return(StartCoroutine(Point(positionX - 1, positionY, false))); } if (up) { yield return(StartCoroutine(Point(positionX, positionY - 1, false))); } if (down) { yield return(StartCoroutine(Point(positionX, positionY + 1, false))); } } else { CheckPoints(positionX, positionY); } if (firstJump) { turns.IncreaseTurn(); } } }