mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-07-31 09:27:42 +02:00
refactor PlayerColor
fixed default playermodel selection
This commit is contained in:
@@ -90,7 +90,7 @@ public class Player implements FieldVisitor<Void>{
|
||||
return figure;
|
||||
}
|
||||
|
||||
public PlayerColor getColor() {
|
||||
public static PlayerColor getColor(int id) {
|
||||
switch ((id%6)+1) {
|
||||
case 1: return PlayerColor.CYAN;
|
||||
case 2: return PlayerColor.YELLOW;
|
||||
|
@@ -6,22 +6,24 @@ import com.jme3.math.ColorRGBA;
|
||||
* Enum representing six distinct colors for players in the game.
|
||||
*/
|
||||
public enum PlayerColor {
|
||||
CYAN(new ColorRGBA(1 / 255f, 190 / 255f, 254 / 255f, 1)),
|
||||
YELLOW(new ColorRGBA(255 / 255f, 255 / 255f, 0 / 255f, 1)),
|
||||
RED(new ColorRGBA(255 / 255f, 0 / 255f, 0 / 255f, 1)),
|
||||
PINK(new ColorRGBA(255 / 255f, 77 / 255f, 166 / 255f, 1)),
|
||||
GREEN(new ColorRGBA(0 / 255f, 204 / 255f, 0 / 255f, 1)),
|
||||
PURPLE(new ColorRGBA(143 / 255f, 0 / 255f, 255 / 255f, 1));
|
||||
CYAN(new ColorRGBA(1 / 255f, 190 / 255f, 254 / 255f, 1), "Cyan"),
|
||||
YELLOW(new ColorRGBA(255 / 255f, 255 / 255f, 0 / 255f, 1), "Gelb"),
|
||||
RED(new ColorRGBA(255 / 255f, 0 / 255f, 0 / 255f, 1), "Rot"),
|
||||
PINK(new ColorRGBA(255 / 255f, 77 / 255f, 166 / 255f, 1), "Pink"),
|
||||
GREEN(new ColorRGBA(0 / 255f, 204 / 255f, 0 / 255f, 1), "Grün"),
|
||||
PURPLE(new ColorRGBA(143 / 255f, 0 / 255f, 255 / 255f, 1), "Lila");
|
||||
|
||||
private final ColorRGBA color;
|
||||
private final String colorName;
|
||||
|
||||
/**
|
||||
* Constructs a PlayerColor with the specified ColorRGBA value.
|
||||
*
|
||||
* @param color the ColorRGBA value associated with the player color
|
||||
*/
|
||||
PlayerColor(ColorRGBA color) {
|
||||
PlayerColor(ColorRGBA color, String colorName) {
|
||||
this.color = color;
|
||||
this.colorName = colorName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,4 +34,13 @@ public enum PlayerColor {
|
||||
public ColorRGBA getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Name of the Color
|
||||
*
|
||||
* @return a String with re corresponing name
|
||||
*/
|
||||
public String getColorName() {
|
||||
return colorName;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user