Beispiel #1
0
 public boolean isPlaceEmpty(Vector2 pos, boolean considerPlanets) {
   Planet np = myPlanetManager.getNearestPlanet(pos);
   if (considerPlanets) {
     boolean inPlanet = np.getPos().dst(pos) < np.getFullHeight();
     if (inPlanet) return false;
   }
   SolSystem ns = myPlanetManager.getNearestSystem(pos);
   if (ns.getPos().dst(pos) < SunSingleton.SUN_HOT_RAD) return false;
   List<SolObject> objs = myObjectManager.getObjs();
   for (int i = 0, objsSize = objs.size(); i < objsSize; i++) {
     SolObject o = objs.get(i);
     if (!o.hasBody()) continue;
     if (pos.dst(o.getPos()) < myObjectManager.getRadius(o)) {
       return false;
     }
   }
   List<FarObjData> farObjs = myObjectManager.getFarObjs();
   for (int i = 0, farObjsSize = farObjs.size(); i < farObjsSize; i++) {
     FarObjData fod = farObjs.get(i);
     FarObj o = fod.fo;
     if (!o.hasBody()) continue;
     if (pos.dst(o.getPos()) < o.getRadius()) {
       return false;
     }
   }
   return true;
 }
Beispiel #2
0
 public void drawDebug(GameDrawer drawer) {
   if (DebugOptions.GRID_SZ > 0)
     myGridDrawer.draw(drawer, this, DebugOptions.GRID_SZ, drawer.debugWhiteTex);
   myPlanetManager.drawDebug(drawer, this);
   myObjectManager.drawDebug(drawer, this);
   if (DebugOptions.ZOOM_OVERRIDE != 0) myCam.drawDebug(drawer);
   drawDebugPoint(drawer, DebugOptions.DEBUG_POINT, DebugCol.POINT);
   drawDebugPoint(drawer, DebugOptions.DEBUG_POINT2, DebugCol.POINT2);
   drawDebugPoint(drawer, DebugOptions.DEBUG_POINT3, DebugCol.POINT3);
 }
Beispiel #3
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();
  }
Beispiel #4
0
  public SolGame(
      SolApplication cmp,
      boolean usePrevShip,
      TextureManager textureManager,
      boolean tut,
      CommonDrawer commonDrawer) {
    myCmp = cmp;
    GameDrawer drawer = new GameDrawer(textureManager, commonDrawer);
    gameColors = new GameColors();
    mySoundManager = new SoundManager();
    mySpecialSounds = new SpecialSounds(mySoundManager);
    myDraMan = new DraMan(drawer);
    myCam = new SolCam(drawer.r);
    myScreens = new GameScreens(drawer.r, cmp);
    myTutorialManager =
        tut
            ? new TutorialManager(commonDrawer.r, myScreens, cmp.isMobile(), cmp.getOptions())
            : null;
    myTextureManager = textureManager;
    myFarBackgroundManagerOld = new FarBackgroundManagerOld(myTextureManager);
    myShipBuilder = new ShipBuilder();
    myEffectTypes = new EffectTypes();
    mySpecialEffects = new SpecialEffects(myEffectTypes, myTextureManager, gameColors);
    myItemManager = new ItemManager(myTextureManager, mySoundManager, myEffectTypes, gameColors);
    myAbilityCommonConfigs =
        new AbilityCommonConfigs(myEffectTypes, myTextureManager, gameColors, mySoundManager);
    hullConfigManager =
        new HullConfigManager(
            myShipBuilder,
            FileManager.getInstance(),
            textureManager,
            myItemManager,
            myAbilityCommonConfigs,
            mySoundManager);
    myNames = new SolNames();
    myPlanetManager =
        new PlanetManager(myTextureManager, hullConfigManager, gameColors, myItemManager);
    SolContactListener contactListener = new SolContactListener(this);
    myFractionMan = new FractionMan(myTextureManager);
    myObjectManager = new ObjectManager(contactListener, myFractionMan);
    myGridDrawer = new GridDrawer(textureManager);
    myChunkManager = new ChunkManager(myTextureManager);
    myPartMan = new PartMan();
    myAsteroidBuilder = new AsteroidBuilder(myTextureManager);
    myLootBuilder = new LootBuilder();
    myFarBgMan = new FarBgMan();
    myMapDrawer = new MapDrawer(myTextureManager, commonDrawer.h);
    myShardBuilder = new ShardBuilder(myTextureManager);
    myGalaxyFiller = new GalaxyFiller();
    myStarPortBuilder = new StarPort.Builder();
    myPlayerSpawnConfig = PlayerSpawnConfig.load(hullConfigManager, myItemManager);
    myDraDebugger = new DraDebugger();
    myBeaconHandler = new BeaconHandler(textureManager);
    myMountDetectDrawer = new MountDetectDrawer(textureManager);
    myRespawnItems = new ArrayList<SolItem>();
    myTimeFactor = 1;

    // from this point we're ready!
    myPlanetManager.fill(myNames);
    myGalaxyFiller.fill(this);
    ShipConfig startingShip =
        usePrevShip ? SaveManager.readShip(hullConfigManager, myItemManager) : null;
    createPlayer(startingShip);
    SolMath.checkVectorsTaken(null);
  }