private void SwipedRight() { points++; CheckHighscore(); pointsRef.text = "{" + points.ToString() + "}"; highscoreRef.text = "{" + highscore.ToString() + "}"; combination = GenerateCombination(); swipeTextRef.text = combination.swipe; arrow.rotation = Quaternion.Euler(new Vector3(0, 0, combination.rotation)); arrowAnim.Play("appear", 0, 0.0f); timer.AddTime(); soundManager.PlayRight(); }
private PossibleCombination GenerateCombination() { float swipesLog2Clamped = Mathf.Clamp(Mathf.FloorToInt(Mathf.Log(points, 2)) + 1, 0, combinations.Length); //Debug.Log("Log2: " + swipesLog2Clamped.ToString()); int index1, index2; index1 = Random.Range(0, (int)swipesLog2Clamped); index2 = Random.Range(0, (int)swipesLog2Clamped); PossibleCombination newCombination = new PossibleCombination(combinations[index1].type, combinations[index1].swipe, combinations[index2].rotation); //print("Type: " + newCombination.type.ToString() + " Swipe: " + newCombination.swipe + " Rot: " + newCombination.rotation); return(newCombination); }
private void Setup() { gameStarted = false; points = 1; highscore = PlayerPrefs.GetInt("highscore"); highscoreRef.text = "{" + highscore.ToString() + "}"; arrowAnim = arrow.GetComponent <Animator>(); soundManager = FindObjectOfType <SoundManager>(); //timer.ResetTimer(); swipeTextRef.text = "R"; arrow.rotation = Quaternion.Euler(0, 0, 0); combination = combinations[0]; }