package entities;
public class Velocity {
private double movey;
private double movex;
private Pair<Double> acceleration = new Pair<>(0.0,0.0);
private Position position;
private Onground onground;
private Pair<Double> value = new Pair<>(0.0,0.0);
public void updateMovey(double movey) {
this.movey = movey;
Pair<Double> temp_if3;
if (this.onground.getValue()) {
temp_if3 = new Pair<>(this.value.getLeft(),movey);
} else {
temp_if3 = this.value;
}
value = temp_if3;
position.updateVelocity(value);
}
public void updateMovex(double movex) {
this.movex = movex;
Pair<Double> temp_if6;
if (this.onground.getValue()) {
temp_if6 = new Pair<>(movex,this.value.getRight());
} else {
temp_if6 = this.value;
}
value = temp_if6;
position.updateVelocity(value);
}
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 Velocity(Position position, Onground onground) {
this.position = position;
this.onground = onground;
}
public Pair<Double> getValue() {
return value;
}
}