我正在尝试创建游戏,并设置枚举以确定用户所在的屏幕。我想将用户所在的屏幕发送到将设置屏幕的方法。
private enum Screen {START, SETTINGS, MAP, ATTACK, END};
private Screen currentScreen;
public void begin () {
setScreen(Screen.START);
}
public void onMouseClick(Location point) {
switch (currentScreen) {
case (Screen.START)
break;
case (Screen.SETTINGS)
break;
case (Screen.MAP)
break;
case (Screen.ATTACK)
break;
case (Screen.END)
break;
}
}
public void setScreen(/*I do not know what to put here, would i put enum, or Screen*/) {
//set up screen here
}
我用什么作为参数?
答案 0 :(得分:1)
语法与Screen
是一个类相同:
public void setScreen(Screen screen) {
//set up screen here
}