package resources;
public class Velocity {
private Pair<Double> moveValue;
private Pair<Double> accelerationValue;
private Position position;
private Onground onground;
private Pair<Double> value;
public void updateByMove(Pair<Double> move) {
this.moveValue = move;
Pair temp_l2;
if ((this.onground.getOnground() && (move.getSecond() >= 0.0))) {
temp_l2 = move;
} else {
temp_l2 = this.value;
}
value = temp_l2;
position.updateByVelocity(value);
}
public void updateByAcceleration(Pair<Double> acceleration) {
this.accelerationValue = acceleration;
Pair temp_l5;
if ((this.onground.getOnground() && (this.value.getSecond() < 0.0))) {
temp_l5 = new Pair((this.value.getFirst() + (0.01 * acceleration.getFirst())), 0.0);
} else {
temp_l5 = new Pair((this.value.getFirst() + (0.01 * acceleration.getFirst())), (this.value.getSecond() + (0.01 * acceleration.getSecond())));
}
value = temp_l5;
position.updateByVelocity(value);
}
public Velocity(Position position, Onground onground) {
this.position = position;
this.onground = onground;
}
public Pair getValue() {
return value;
}
}