예제 #1
0
 public void apply(ObjectInfoControl object) {
   object.setPosition(this.position);
   object.setRotation(this.rotation);
   object.setLinearVelocity(this.linearvelocity);
   object.setAngularVelocity(this.angularvelocity);
   FlightControl flight = object.getObjectControl(FlightControl.class);
   if (flight != null) {
     flight.setThrottle(this.throttle);
     flight.setAileron(this.aileron);
     flight.setRudder(this.rudder);
     flight.setElevator(this.elevator);
     flight.setStrafe(this.strafe);
     flight.setLift(this.lift);
     flight.setCruise(this.cruise);
     flight.setGlide(this.glide);
   }
   WeaponSystemControl weapons = object.getObjectControl(WeaponSystemControl.class);
   if (weapons != null) {
     weapons.setPrimaryMode(this.primaryMode);
     if (this.primaryFire) weapons.firePrimary();
     if (this.secondaryFire) weapons.fireSecondary();
   }
   SensorControl sensors = object.getObjectControl(SensorControl.class);
   if (sensors != null) {
     sensors.target(this.targetId);
   }
 }
예제 #2
0
 public ClientActionData(ObjectInfoControl clientObject) {
   FlightControl flight = clientObject.getObjectControl(FlightControl.class);
   this.id = clientObject.getId();
   this.position.set(clientObject.getPosition());
   this.rotation.set(clientObject.getRotation());
   this.linearvelocity.set(clientObject.getLinearVelocity());
   this.angularvelocity.set(clientObject.getAngularVelocity());
   if (flight != null) {
     this.throttle = flight.getThrottle();
     this.aileron = flight.getAileron();
     this.rudder = flight.getRudder();
     this.elevator = flight.getElevator();
     this.strafe = flight.getStrafe();
     this.lift = flight.getLift();
     this.cruise = flight.getCruise();
     this.glide = flight.getGlide();
   }
   WeaponSystemControl weapons = clientObject.getObjectControl(WeaponSystemControl.class);
   if (weapons != null) {
     this.primaryMode = weapons.getPrimaryMode();
     this.primaryFire = weapons.isPrimaryFiring();
     this.secondaryFire = weapons.isSecondaryFiring();
     if (weapons.getTarget() != null) {
       this.targetId = weapons.getTarget().getObject().getId();
     }
   }
 }