private void SetFill() { if (percentage > 1) { return; } float p = (Skier.GetInitialSkierY() - Skier.GetSkierY()) / (Skier.GetInitialSkierY() - FinishLine.Instance.GetFinishLineY()); percentage = p <= 1 ? p : 1;//(distance - (Skier.GetSkierY() - FinishLine.Instance.GetFinishLineY())) / distance; fill.fillAmount = percentage; score.transform.localPosition = new Vector3(fillLength * percentage, score.transform.localPosition.y, score.transform.localPosition.z); score.GetComponentInChildren <Text>().text = ((int)(100 * percentage)).ToString() + "%"; if (!GameManager.GetInstance().GetIsGameStart()) { return; } if (percentage - lastPercentage >= 0.005) { GameManager.GetInstance().SetFraction(GameManager.GetInstance().GetFraction() + 30); lastPercentage = percentage; } }
public void AddEnvSpeed() { per = (Skier.GetInitialSkierY() - Skier.GetSkierY()) / (Skier.GetInitialSkierY() - FinishLine.Instance.GetFinishLineY()); if (per > 0) { envSpeedAdd = envSpeed * (per); } }
///<summary> ///游戏结束属性设置 ///</summary> private void GameOver() { // if (!GameManager.GetInstance().GetIsGameStart()) return; float now = (Skier.GetInitialSkierY() - Skier.GetSkierY()) / (Skier.GetInitialSkierY() - FinishLine.Instance.GetFinishLineY()); if (now > GameManager.GetInstance().GetBestScore()) { GameManager.GetInstance().SetBestScore(now); } float fraction = GameManager.GetInstance().GetFraction(); float bestFraction = GameManager.GetInstance().GetBestFraction(); if (fraction > bestFraction) { GameManager.GetInstance().SetBestFraction(fraction); } GameManager.GetInstance().Save(); GameManager.GetInstance().SetFraction(0); GameManager.GetInstance().SetIsGameStart(false); GameManager.GetInstance().SetCanRestart(false);//刚死亡暂时不可以重开,由系统机制决定何时重开 //GameManager.GetInstance().SetBonusNum(0); //death.Play(); //adDeath.Play(); //adSki.Stop(); //StopPower(); //ball.enabled = false; //shadow.enabled = false; //dots.Stop(); //xInput = 0; //yInput = 0; //velocity = Vector3.zero; StartCoroutine(Dealy()); }