Ejemplo n.º 1
0
  public void update() {
    myDraDebugger.update(this);

    if (myPaused) return;

    myTimeFactor = DebugOptions.GAME_SPEED_MULTIPLIER;
    if (myHero != null) {
      ShipAbility ability = myHero.getAbility();
      if (ability instanceof SloMo) {
        float factor = ((SloMo) ability).getFactor();
        myTimeFactor *= factor;
      }
    }
    myTimeStep = Const.REAL_TIME_STEP * myTimeFactor;
    myTime += myTimeStep;

    myPlanetManager.update(this);
    myCam.update(this);
    myChunkManager.update(this);
    myMountDetectDrawer.update(this);
    myObjectManager.update(this);
    myDraMan.update(this);
    myMapDrawer.update(this);
    mySoundManager.update(this);
    myBeaconHandler.update(this);

    myHero = null;
    myTranscendentHero = null;
    List<SolObject> objs = myObjectManager.getObjs();
    for (int i = 0, objsSize = objs.size(); i < objsSize; i++) {
      SolObject obj = objs.get(i);
      if ((obj instanceof SolShip)) {
        SolShip ship = (SolShip) obj;
        Pilot prov = ship.getPilot();
        if (prov.isPlayer()) {
          myHero = ship;
          break;
        }
      }
      if (obj instanceof StarPort.Transcendent) {
        StarPort.Transcendent trans = (StarPort.Transcendent) obj;
        FarShip ship = trans.getShip();
        if (ship.getPilot().isPlayer()) {
          myTranscendentHero = trans;
          break;
        }
      }
    }

    if (myTutorialManager != null) myTutorialManager.update();
  }
Ejemplo n.º 2
0
 @Override
 public boolean update(SolGame game, SolShip owner, boolean tryToUse) {
   myShouldTeleport = false;
   if (!tryToUse) return false;
   Vector2 pos = owner.getPos();
   Fraction frac = owner.getPilot().getFraction();
   SolShip ne = game.getFractionMan().getNearestEnemy(game, MAX_RADIUS, frac, pos);
   if (ne == null) return false;
   Vector2 nePos = ne.getPos();
   Planet np = game.getPlanetMan().getNearestPlanet();
   if (np.isNearGround(nePos)) return false;
   for (int i = 0; i < 5; i++) {
     myNewPos.set(pos);
     myNewPos.sub(nePos);
     myAngle = myConfig.angle * SolMath.rnd(.5f, 1) * SolMath.toInt(SolMath.test(.5f));
     SolMath.rotate(myNewPos, myAngle);
     myNewPos.add(nePos);
     if (game.isPlaceEmpty(myNewPos, false)) {
       myShouldTeleport = true;
       return true;
     }
   }
   return false;
 }