package models; import entities.*; import entities.modelExtentions.Stage; import java.util.*; public class JumpGameModel implements IModel{ private Gameover gameover; private Time time; private Onground onground; private Ground ground; private Clear clear; private Position position; private Velocity velocity; private Move move; private Acceleration acceleration; private Mass mass; private Force force; private Stage stage; //added public JumpGameModel() { gameover = new Gameover(); time = new Time(); onground = new Onground(); ground = new Ground(onground); clear = new Clear(); position = new Position(onground,clear,gameover,ground); velocity = new Velocity(position,onground); move = new Move(velocity); acceleration = new Acceleration(velocity,onground); mass = new Mass(acceleration); force = new Force(acceleration); stage = new Stage(); // added } public void gravity(double y) { this.force.gravity(y); this.time.gravity(y); } public void openHole() { this.ground.openHole(); } public void closeHole() { this.ground.closeHole(); } public void moveY(double y) { this.move.moveY(y); } public void moveX(double x) { this.move.moveX(x); } public void setMass(double x) { this.mass.setMass(x); } public Pair<Double> getAcceleration() { return acceleration.getValue(); } public Pair<Double> getMove() { return move.getValue(); } public double getMass() { return mass.getValue(); } public boolean getClear() { return clear.getValue(); } public boolean getGround() { return ground.getValue(); } public Pair<Double> getForce() { return force.getValue(); } public Pair<Double> getVelocity() { return velocity.getValue(); } public Pair<Double> getPosition() { return position.getValue(); } public boolean getOnground() { return onground.getValue(); } public double getTime() { return time.getValue(); } public boolean getGameover() { return gameover.getValue(); } //--------------------------------------------------------------- //--------------------------------------------------------------- // added public Stage getStage() { return stage; } //--------------------------------------------------------------- // 地面のフラグ更新 public void updateGroundFlag() { double x = position.getValue().getLeft(); if (stage.isOpenFlag(x)) ground.openHole(); if (stage.isCloseFlag(x)) ground.closeHole(); // System.out.print("x: " + x + "/"); // System.out.println("Ground: " + ground.getValue() + "/"); // System.out.print("Clear: " + clear.getClear() + "/"); // System.out.println("GameOver: " + gameover.getGameover()); } }