Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.nolimitscoaster.*;
- import nlvm.math3d.*;
- public class CarAction {
- private CarHandler handler;
- private float startTime;
- private float totalTime;
- private float endTime;
- private int direction;
- //Animation directions
- private final int LEFT = 0;
- private final int RIGHT = 1;
- private final int FRONT = 2;
- private final int BACK = 3;
- private Vector3f objectRotation;
- public CarAction(CarHandler handler, float startTime, float totalTime, int direction) {
- this.handler = handler;
- this.startTime = startTime;
- this.totalTime = totalTime;
- this.endTime = startTime + totalTime;
- this.direction = direction;
- objectRotation = new Vector3f();
- }
- public CarAction(CarHandler handler, double startTime, float totalTime, int direction) {
- this(handler, (float) startTime, totalTime, direction);
- }
- public void process(float tick) {
- double currentTime = handler.getSim().getCurAbsSimulationTimeSec();
- if (currentTime >= endTime) {
- return;
- }
- switch(direction) {
- case LEFT:
- handler.changeZRotation(true, .005f);
- break;
- case RIGHT:
- handler.changeZRotation(false, .005f);
- break;
- case FRONT:
- handler.changeXRotation(false, .005f);
- break;
- case BACK:
- handler.changeXRotation(true, .005f);
- break;
- default:
- System.err.println("Wrong movement direction!");
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment