Skip to content

Commit

Permalink
#getMetric() on PlayerMetrics based on MetricType
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealEmissions committed Mar 21, 2024
1 parent c33ee0d commit f8d9668
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/src/uk/ac/york/student/player/PlayerMetrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ public void changeMetric(@NotNull MetricType type, MetricEffect effect, float ch
}
}

public PlayerMetric getMetric(@NotNull MetricType type) {
switch (type) {
case ENERGY:
return energy;
case HAPPINESS:
return happiness;
case STUDY_LEVEL:
return studyLevel;
default:
throw new IllegalArgumentException("Invalid metric type: " + type);
}
}

/**
* Get the list of all player metrics.
* @return An unmodifiable list of PlayerMetric objects.
Expand Down

0 comments on commit f8d9668

Please sign in to comment.