add segments to round class
This commit is contained in:
parent
06b61bdcbb
commit
f95a1e9260
2 changed files with 15 additions and 7 deletions
|
@ -29,7 +29,7 @@ public class Game extends ApplicationAdapter {
|
|||
private double tickProgress = 0;
|
||||
|
||||
|
||||
private RoundData roundData;
|
||||
private Round round;
|
||||
private UI ui;
|
||||
|
||||
@Override
|
||||
|
@ -40,7 +40,7 @@ public class Game extends ApplicationAdapter {
|
|||
img = new Texture("badlogic.jpg");
|
||||
|
||||
ui = new UI(50, 280, 10);
|
||||
roundData = new RoundData(10);
|
||||
round = new Round(10);
|
||||
|
||||
Face.setBlankFaceSprite(new Texture("blank_die_face.png"));
|
||||
Face.setPipSprite(new Texture("pip.png"));
|
||||
|
@ -66,15 +66,15 @@ public class Game extends ApplicationAdapter {
|
|||
public void tick() {
|
||||
processInput();
|
||||
|
||||
ui.setRemainingRerolls(roundData.getRerolls());
|
||||
ui.setRemainingRerolls(round.getRerolls());
|
||||
}
|
||||
|
||||
public void processInput() {
|
||||
Input input = Gdx.input;
|
||||
|
||||
if (input.isKeyJustPressed(Input.Keys.R) && roundData.getRerolls() > 0) { //reroll dice that aren't locked
|
||||
if (input.isKeyJustPressed(Input.Keys.R) && round.getRerolls() > 0) { //reroll dice that aren't locked
|
||||
dice.stream().filter(d -> !d.isSelected()).forEach(Die::roll);
|
||||
roundData.reduceRerolls(1);
|
||||
round.reduceRerolls(1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dice.size(); i++) { //lock dice, iterating over for each keycode
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
package com.monjaro.gamejam.main;
|
||||
|
||||
public class RoundData {
|
||||
import com.monjaro.gamejam.segment.Segment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Round {
|
||||
|
||||
private final List<Segment> segments;
|
||||
private int rerolls;
|
||||
|
||||
public RoundData(int rerolls){
|
||||
public Round(List<Segment> segments, int rerolls){
|
||||
this.rerolls = rerolls;
|
||||
this.segments = segments;
|
||||
}
|
||||
|
||||
public int getRerolls() {
|
||||
|
@ -18,4 +25,5 @@ public class RoundData {
|
|||
public void reduceRerolls(int i) {
|
||||
rerolls -= i;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue