public enum Levels
{
LevelState1 = 0,
LevelState2 = 1,
LevelState3 = 2
}
private Levels currentLevel;
public void ChooseLevel(Levels levelstate)
{
switch (levelstate)
{
case Levels.LevelState1:
currentLevel = Levels.LevelState1;
...
break;
case Levels.LevelState2:
currentLevel = Levels.LevelState2;
...
break;
case Levels.LevelState3:
currentLevel = Levels.LevelState3;
...
break;
}
}
//The variable CurrentLevel is an integer
ChooseLevel(Levels."LevelState"+game1.CurrentLevel.ToString());
我总是在最后一行收到此错误消息:Identifier expected 我应该改变什么?我不知道如何解决这个问题。