Beispiel #1
0
 public void saveShip() {
   if (myTutorialManager != null) return;
   HullConfig hull;
   float money;
   ArrayList<SolItem> items;
   if (myHero != null) {
     hull = myHero.getHull().config;
     money = myHero.getMoney();
     items = new ArrayList<SolItem>();
     for (List<SolItem> group : myHero.getItemContainer()) {
       for (SolItem i : group) {
         items.add(0, i);
       }
     }
   } else if (myTranscendentHero != null) {
     FarShip farH = myTranscendentHero.getShip();
     hull = farH.getHullConfig();
     money = farH.getMoney();
     items = new ArrayList<SolItem>();
     for (List<SolItem> group : farH.getIc()) {
       for (SolItem i : group) {
         items.add(0, i);
       }
     }
   } else {
     hull = myRespawnHull;
     money = myRespawnMoney;
     items = myRespawnItems;
   }
   SaveManager.writeShip(hull, money, items, this);
 }
Beispiel #2
0
  // can be performed in update
  public void maybeTeleport(SolGame game, SolShip owner) {
    if (!myShouldTeleport) return;

    TextureAtlas.AtlasRegion tex = game.getTexMan().getTex(TEX_PATH, null);
    float blipSz = owner.getHull().config.getApproxRadius() * 3;
    game.getPartMan().blip(game, owner.getPos(), SolMath.rnd(180), blipSz, 1, Vector2.Zero, tex);
    game.getPartMan().blip(game, myNewPos, SolMath.rnd(180), blipSz, 1, Vector2.Zero, tex);

    float newAngle = owner.getAngle() + myAngle;
    Vector2 newSpd = SolMath.getVec(owner.getSpd());
    SolMath.rotate(newSpd, myAngle);

    Body body = owner.getHull().getBody();
    body.setTransform(myNewPos, newAngle * SolMath.degRad);
    body.setLinearVelocity(newSpd);

    SolMath.free(newSpd);
  }
Beispiel #3
0
  public void beforeHeroDeath() {
    if (myHero == null) return;

    float money = myHero.getMoney();
    ItemContainer ic = myHero.getItemContainer();

    setRespawnState(money, ic, myHero.getHull().config);

    myHero.setMoney(money - myRespawnMoney);
    for (SolItem item : myRespawnItems) {
      ic.remove(item);
    }
  }