Доброго времени суток. В игре есть класс GameScore, в котором есть некоторое кол-во вложенных классов, которые должны хранить данные для сравнений. Вот сам класс:
public class GameScore : MonoBehaviour
{
//first level info
public class FirstLevel
{
internal const float HightScore = 7f;
internal const float MiddleScore = 11f;
internal const float LowScore = 15f;
internal static int bestResult = 0;
}
//second level info
public class SecondLevel
{
internal const float HightScore = 5f;
internal const float MiddleScore = 7f;
internal const float LowScore = 9f;
internal static int bestResult = 0;
}
}
А теперь сам вопрос: как мне из другого класса получить доступ к вложенному классу FirstLevel
, например?
P.S. Я пытаюсь добавить к другому классу public переменную GameScore
и уже оттуда получить доступ к вложенному классу, но ничего не получается.
Update (как я пытаюсь получить доступ к классу FirstLevel):
public GameScore GameScorePrefab;
private void CheckStars()
{
int bestResult = GameScorePrefab.FirstLevel.bestResult;
//другой код
}
После этого пишет: "GameScore.FirstLevel is a type, which is not valid in the given context.FirstLevel cannot reference a type through an expresion, try GameScore.FirstLevel instead." А интелесенс класс FirstLevel вообще не видит.