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); }
public void respawn() { if (myHero != null) { beforeHeroDeath(); myObjectManager.removeObjDelayed(myHero); } else if (myTranscendentHero != null) { FarShip farH = myTranscendentHero.getShip(); setRespawnState(farH.getMoney(), farH.getIc(), farH.getHullConfig()); myObjectManager.removeObjDelayed(myTranscendentHero); } createPlayer(null); }
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(); }