У меня проблема с увеличением счета в моем клоне космических захватчиков.У меня 2 ошибки.
Активы / Сценарии / ScoreManager.cs (26,12): ошибка CS0103: имя `retryLevel 'не существует в текущем контексте
Активы /Scripts / ScoreManager.cs (55,43): ошибка CS1061: Тип int' does
not contain a definition for
Tostring 'и метод расширения Tostring' of type
int' не найден.Вам не хватает ссылки на сборку?
Где и что именно в моем скрипте я должен изменить?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScoreManager : MonoBehaviour
{
int i = 0;
public GameObject HighScoreDisplay;
public Text scoreDisplay;
public int score = 0;
public Text[] highScoreTables;
private void Start()
{
if (HighScoreDisplay == null || scoreDisplay == null) {
Debug.LogWarning("Values are missing on the ScoreManager!");
return;
}
retryLevel();
}
private void update()
{
scoreDisplay.text = score.ToString();
}
public void ModifyScore(int scoreToAdd)
{
score += scoreToAdd;
}
public void fromScratch(){
score = 0;
HighScoreDisplay.SetActive(false);
}
public void PlayerDied()
{
HighScores.AddScore(score);
foreach (Text table in highScoreTables)
{
table.text = HighScores.scoreTable[i].Tostring();
i++;
}
HighScoreDisplay.SetActive(true);
score = 0;
}
}
public static class HighScores
{
public static List<int> scoreTable = new List<int>{0,0,0};
public static void AddScore(int score)
{
if (score > scoreTable[2])
{
scoreTable[2] = score;
}
else if (score > scoreTable[1])
{
scoreTable[1] = score;
}
else if (score > scoreTable[0])
{
scoreTable[0] = score;
}
}
}