public void UpdateScore(int score) { ScoreTxt.text = score.ToString(); ScoreTxt.transform.DOScale(Vector3.one * 0.15f, 0.2f).OnComplete(() => { ScoreTxt.transform.DOScale(Vector3.one, 0.1f); }); updateTxt.OnScore("+1"); }
// public void public void HappyFace() { // CamShake(); GameManager.instance.CalculateXP(); if (isClose) { if (!GameManager.instance.godMode) { //HideFaces(); GameManager.instance.OnCloseCallEvent(); GameManager.instance.PlaySound(closeSound); if (!popUpFreez && !popUpShield) { Bonus.OnScore("Close one !!"); } else { popUpFreez = false; popUpShield = false; } Instantiate(GameManager.instance.coinPrefab); // Instantiate(GameManager.instance.ExplodeParticle); score += 100; //GameManager.instance.AddCoins(); GameManager.instance.IncrementCharge(); GameManager.instance.PlaySound(GameManager.instance.progressBar, 0.2f); StartCoroutine(GameManager.instance.IncrementCoin(50)); if (GameManager.instance.vibration && !GameManager.instance.powerSaver) { // Handheld.Vibrate(); //StartCoroutine(Vibrate()); HapticFeedback.Generate(UIFeedbackType.ImpactHeavy); } //CamShake(); } else { StartCoroutine(GameManager.instance.IncrementCoin(5)); } } else { if (!GameManager.instance.godMode) { if (!popUpFreez && !popUpShield) { Bonus.OnScore("+50"); } else { popUpFreez = false; popUpShield = false; } score += 50; Instantiate(GameManager.instance.ExplodeParticle); if (GameManager.instance.vibration && !GameManager.instance.powerSaver) { HapticFeedback.Generate(UIFeedbackType.ImpactLight); // StartCoroutine(Vibrate()); } } } GameManager.instance.PlaySound(GameManager.instance.matchsound); //Invoke("MehFace", 1.2f); ScoreTxt.transform.DOScale(Vector3.one * 0.15f, 0.2f).OnComplete(() => { ScoreTxt.transform.DOScale(Vector3.one, 0.1f); }); ScoreTxt.text = score.ToString(); if (score > 1500 && !enlargedScreen1) { PlayerPrefs.SetInt("Crossed0", PlayerPrefs.GetInt("Crossed0", 0) + 1); //enlargedScreen1 = true; GameManager.instance.EnlargeScreen(); } if (score > 3000 && !enlargedScreen2) { PlayerPrefs.SetInt("Crossed1", PlayerPrefs.GetInt("Crossed1", 0) + 1); enlargedScreen2 = true; GameManager.instance.EnlargeScreen2(); } if (score > 5000 && !frenzy1) { PlayerPrefs.SetInt("Crossed1", PlayerPrefs.GetInt("Crossed1", 0) + 1); frenzy1 = true; GameManager.instance.Frenzy(); } if (score > 7500 && !frenzy2) { PlayerPrefs.SetInt("Crossed1", PlayerPrefs.GetInt("Crossed1", 0) + 1); frenzy2 = true; GameManager.instance.Frenzy2(); } for (int i = 0; i < stageScoreLimit.Length; i++) { if (score < stageScoreLimit[i]) { float tempScore = score; float stageScore = stageScoreLimit[i]; if (i != 0) { tempScore -= stageScoreLimit[i - 1]; stageScore -= stageScoreLimit[i - 1]; } else { tempScore = score; stageScore = stageScoreLimit[i]; } float percent = tempScore / stageScoreLimit[i]; for (int j = 0; j < timeGapControllers.Count; j++) { if (timeGapControllers[j].PositionNumber == i) { GameManager.instance.TimeGap = timeGapControllers[j].initialSpeed - ((timeGapControllers[j].initialSpeed - timeGapControllers[j].endSpeed) * percent); return; } } } } }