public void ShowHighScore() { if (!Social.localUser.authenticated) { Social.localUser.Authenticate((bool success) => { if (!success) { // Couldn't connect, should probably show an error Debug.Log("Logging in; Failed"); GameObject.Find("LoginFailed").transform.localScale = LoginFailed.originalScale; return; } }); } int highscoreRelax = PlayerPrefs.GetInt("highscore1"); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_relax, highscoreRelax); int highscoreNormal = PlayerPrefs.GetInt("highscore2"); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_normal, highscoreNormal); int highscoreDevil = PlayerPrefs.GetInt("highscore3"); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_devil, highscoreDevil); Social.Active.ShowLeaderboardUI(); }
private void MoveGround() { speed = GetSpeedFromAngle(RecomputeBallAngle()); Color playersColor = ComputeColor(); // Move ground left foreach (Transform child in Cubes.transform) { child.gameObject.transform.position += new Vector3(-1, 0, 0) * speed; } foreach (Transform child in Cubes.transform) { if (child.gameObject.transform.position.x < -worldScreenWidth) { child.gameObject.transform.position += new Vector3(2 * worldScreenWidth, 0, 0); changedColor = false; } else if (!changedColor && child.gameObject.transform.position.x + child.transform.lossyScale.x / 2 < Ball.transform.position.x) { // check color //Debug.Log("Ball color = " + Ball.transform.FindChild("Capsule").gameObject.GetComponent<Renderer>().material.color + " Light color = " + playersColor); if (Ball.transform.Find("Capsule").gameObject.GetComponent <Renderer>().material.color.Equals(playersColor)) { Color newColor = new Color(Random.value, Random.value, Random.value, 1.0f); // apply it on current object's material ChangeBallColor(colors[Random.Range(0, colors.Length)]); ResetRGBValues(); points += ComputePoints(playersColor); CheckHighscores(points); if (points > 5) { colors = colors3; } else if (points > 2) { colors = colors2; } if (mode == 1) { rotationAngle += additionalSpeed; additionalSpeed *= 0.6f; } else if (mode == 2) { rotationAngle += additionalSpeed; additionalSpeed *= 0.66f;// * multiplCoef; //multiplCoef = multiplCoef * multiplCoef; } else if (mode == 3) { rotationAngle += additionalSpeed; additionalSpeed *= 0.66f; } } else { int highscore = PlayerPrefs.GetInt("highscore" + mode); #if UNITY_ANDROID ActualiseAchievements(); if (points > highscore) { Highscore.changed = true; if (mode == 3) { highscoreDevil = points; if (Social.localUser.authenticated) { Social.ReportProgress(GooglePlayConfig.achievement_leviathan, 10 * highscoreDevil, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_mefistofeles, 2 * highscoreDevil, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_beelzebub, highscoreDevil, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_lucifer, highscoreDevil / 5, (bool success) => { }); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_devil, highscoreDevil); } } else if (mode == 2) { highscoreNormal = points; if (Social.localUser.authenticated) { Social.ReportProgress(GooglePlayConfig.achievement_extraordinary, 10 * highscoreNormal, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_rare, 2 * highscoreNormal, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_epic, highscoreNormal, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_phenomenal, highscoreNormal / 5, (bool success) => { }); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_normal, highscoreNormal); } } else { highscoreRelax = points; if (Social.localUser.authenticated) { Social.ReportProgress(GooglePlayConfig.achievement_talented, 10 * highscoreRelax, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_chiller, 2 * highscoreRelax, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_patient, highscoreRelax, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_nolife, highscoreRelax / 5, (bool success) => { }); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_relax, highscoreRelax); } } PlayerPrefs.SetInt("highscore" + mode, points); PlayerPrefs.Save(); } #endif PlayerPrefs.SetInt("last" + mode, points); endOfTurn = true; if (!AchievementAlert.Active()) { SceneManager.LoadScene("menu"); } else { gameFinished = true; } } changedColor = true; } RefreshReflectors(child, playersColor); } }