package entities;
public class Velocity {
private Pair<Double> acceleration = new Pair<>(0.0,0.0);
private Pair<Double> move = new Pair<>(1.0,0.0);
private Position position;
private Onground onground;
private Pair<Double> value = new Pair<>(0.0,0.0);
public void updateAcceleration(Pair<Double> acceleration) {
this.acceleration = acceleration;
Pair<Double> temp_if7;
if ((this.onground.getValue()&&(this.value.getRight()<0.0))) {
temp_if7 = new Pair<>((this.value.getLeft()+(0.01*acceleration.getLeft())),0.0);
} else {
temp_if7 = new Pair<>((this.value.getLeft()+(0.01*acceleration.getLeft())),(this.value.getRight()+(0.01*acceleration.getRight())));
}
value = temp_if7;
position.updateVelocity(value);
}
public void updateMove(Pair<Double> move) {
this.move = move;
Pair<Double> temp_if8;
if ((this.onground.getValue()&&(move.getRight()>=0.0))) {
temp_if8 = move;
} else {
temp_if8 = this.value;
}
value = temp_if8;
position.updateVelocity(value);
}
public Velocity(Position position, Onground onground) {
this.position = position;
this.onground = onground;
}
public Pair<Double> getValue() {
return value;
}
}