Develop #1
@@ -0,0 +1,7 @@
|
||||
package org.project.constants.gameConstant;
|
||||
|
||||
public enum PlayerRoles {
|
||||
KNIGHT,
|
||||
WIZARD,
|
||||
ASSASSIN
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.project.constants.gameConstant;
|
||||
|
||||
import org.project.entity.players.Assassin;
|
||||
import org.project.entity.players.Knight;
|
||||
import org.project.entity.players.Player;
|
||||
import org.project.entity.players.Wizard;
|
||||
|
||||
public final class PlayerRolesExt {
|
||||
private PlayerRolesExt() {}
|
||||
|
||||
public static Player CreatePlayer(PlayerRoles role, String name, int level) {
|
||||
return switch (role) {
|
||||
case KNIGHT -> new Knight(name, level);
|
||||
case ASSASSIN -> new Assassin(name, level);
|
||||
case WIZARD -> new Wizard(name, level);
|
||||
};
|
||||
}
|
||||
|
||||
public static Player CreatePlayer(PlayerRoles role, String name) {
|
||||
return switch (role) {
|
||||
case KNIGHT -> new Knight(name);
|
||||
case ASSASSIN -> new Assassin(name);
|
||||
case WIZARD -> new Wizard(name);
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user