Skip to content

Commit

Permalink
Fix CycleTracker
Browse files Browse the repository at this point in the history
  • Loading branch information
zbx1425 committed Aug 24, 2023
1 parent 4a543a5 commit f4a5181
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ public CycleTracker(Object[] params) {
states = new String[params.length / 2];
offsets = new float[params.length / 2];
for (int i = 0; i < params.length; i += 2) {
if (!(params[i] instanceof String)) throw new IllegalArgumentException();
if (!(params[i + 1] instanceof Float)) throw new IllegalArgumentException();
states[i / 2] = params[i].toString();
float elemDuration = Float.parseFloat(params[i + 1].toString());
offsets[i / 2] = offset;
Expand All @@ -32,7 +30,7 @@ public CycleTracker(Object[] params) {
public void tick() {
double time = TimingUtil.elapsed() % cycleDuration;
int cycleNum = (int) (TimingUtil.elapsed() / cycleDuration);
for (int i = 0; i < offsets.length; i++) {
for (int i = offsets.length - 1; i >= 0; i--) {
if (time >= offsets[i]) {
int stateNum = cycleNum * offsets.length + i;
currentState = states[i];
Expand Down

0 comments on commit f4a5181

Please sign in to comment.