enhance engines
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
package org.project.engine;
|
||||
|
||||
import org.project.constants.appConstants.GameModes;
|
||||
import org.project.constants.gameConstant.PlayerRoles;
|
||||
import org.project.constants.gameConstant.PlayerRolesExt;
|
||||
import org.project.entity.players.Player;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public abstract class MainEngine {
|
||||
protected MainEngine() {}
|
||||
@@ -13,4 +18,36 @@ public abstract class MainEngine {
|
||||
case GameModes.MULTI_PLAYER_LOCAL -> new MultiplayerEngine();
|
||||
};
|
||||
}
|
||||
|
||||
protected Player RoleMenu(String name, int level) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
PlayerRoles[] roles = PlayerRoles.values();
|
||||
int index = 0;
|
||||
while (true) {
|
||||
for (PlayerRoles role : roles) {
|
||||
System.out.println(index + " > " + role.name().toLowerCase());
|
||||
}
|
||||
int choice = scanner.nextInt();
|
||||
|
||||
if (choice >= 0 && choice < roles.length) {
|
||||
return PlayerRolesExt.CreatePlayer(roles[choice], name, level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Player RoleMenu(String name) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
PlayerRoles[] roles = PlayerRoles.values();
|
||||
int index = 0;
|
||||
while (true) {
|
||||
for (PlayerRoles role : roles) {
|
||||
System.out.println(index + " > " + role.name().toLowerCase());
|
||||
}
|
||||
int choice = scanner.nextInt();
|
||||
|
||||
if (choice >= 0 && choice < roles.length) {
|
||||
return PlayerRolesExt.CreatePlayer(roles[choice], name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user