private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("controlCollider")) { //calculates extra point amount SuccessiveRingCount += 1; PointAmount = uiManager.ExtraPointAmount(SuccessiveRingCount); //calculates current point and send it to UiManager Point += PointAmount; uiManager.Point = Point; //best score settings if (Point > BestScore) { gameDatas.BestScore = Point; gameDatas.LevelCount = LevelCount; gameDatas.PlatformCount = PlatformCount; SaveLoad.gameDatas = gameDatas; SaveLoad.Save(); } if (bestScoreObject.activeSelf == true) { bestScoreObject.SetActive(false); } //destroyes the control point that is passed Destroy(other.transform.gameObject); //this is the same with successive ring count //but this one is used for percentage calculations ringCountThatPassed += 1; //calculates current percentage and send it to uiManager int ringCount = PlatformCount - 1; uiManager.PercentageOfRingCountThatPassed = (ringCountThatPassed * 100) / ringCount; //shows and animates point uiManager.IsPointShown = true; //fragmentation sets gameManager.IsBallPassesTheRing = true; GameObject passedRing = other.transform.parent.gameObject; gameManager.PassedRing = passedRing; } if (other.gameObject.CompareTag("baseSlice")) { SuccessiveRingCount = 0; } //when the ball touches forbidden slices... if (other.gameObject.CompareTag("forbiddenSlice") && canCollide) { Time.timeScale = 0f; mainCanvas.transform.Find("GameOverScene").gameObject.SetActive(true); touchControlManager.IsControlActive = false; canCollide = false; //if there are pointTextObjects delete gameEnvironmentSetUp.DestroyGameObjectsInAnArray("pointText"); } //when the level is completed if (other.gameObject.CompareTag("lastRingSlice") && canCollide) { //if there are pointTextObjects delete gameEnvironmentSetUp.DestroyGameObjectsInAnArray("pointText"); levelSettings.ContinueToNextLevel(this, gameDatas); } }