void Update() { hightScoreTex.text = "Score:" + ScoreInfo.GetTotalScore(); /* * if(GameController.Instance.gameStates == GameController.GameStates.End) * { * if (scoreCount < 1) * { * scoreCount++; * * totalScore = (meteoDefeatCount * meteoScore) + (ufoDefeatCount * ufoScore) + (marsDefeatCount * marsScore); * * if(totalScore > hightScore) * { * hightScore = totalScore; * PlayerPrefs.SetInt(key, hightScore); * hightScoreTex.text = "Score:" + ScoreInfo.GetTotalScore(); * } * } * }*/ // スペース押すとハイスコアの初期化 if (Input.GetKeyDown("space")) { PlayerPrefs.DeleteAll(); } }
// Use this for initialization void Start() { //ファイルを読み込み ScoreInfo.Score.Name = "Name " + nameCount; ScoreInfo.Read(); foreach (Score s in ScoreInfo.Scores) { Debug.Log(s.Name + " <=> Total :" + ScoreInfo.GetTotalScore(s)); } }
// スコアを表示させる時の処理 private void dispScore() { // 他のUIをすべて非表示にする allUi.SetActive(false); // スコアのUIを表示させる scoreUi.SetActive(true); // スコアのアニメーションを再生させる scoreUi.GetComponent <Animator>().SetBool("isAnimStart", true); ScoreInfo.Score.hp = hitPoint; ScoreInfo.AddToHighScores(); for (int i = 0; i < ScoreInfo.Scores.Count; i++) { textScore[i].GetComponent <Text>().text = ScoreInfo.GetTotalScore(ScoreInfo.Scores[i]).ToString(); if (ScoreInfo.Scores[i] == ScoreInfo.Score) { // 自分のスコアがランクインしたら色を変える textScore[i].GetComponent <Text>().color = new Color(255, 0, 0); } } }