Ejemplo n.º 1
0
 public CougarScreen(Game game, int state) {
   super(game);
   this.givenState = state;
   mission = ((CougarMission) MissionManager.getInstance().get(CougarMission.ID));
   this.mediaPlayer = new MediaPlayer();
   AndroidFileIO fio = (AndroidFileIO) ((Alite) game).getFileIO();
   String path = "sound/mission/4/";
   try {
     if (state == 0) {
       missionLine = new MissionLine(fio, path + "01.mp3", missionDescription);
       cougar = new Cougar((Alite) game);
       cougar.setPosition(200, 0, -700.0f);
       mission.setPlayerAccepts(true);
       mission.setTarget(
           ((Alite) game).getGenerator().getCurrentSeed(),
           ((Alite) game).getPlayer().getCurrentSystem().getIndex(),
           1);
     } else {
       AliteLog.e(
           "Unknown State", "Invalid state variable has been passed to CougarScreen: " + state);
     }
   } catch (IOException e) {
     AliteLog.e("Error reading mission", "Could not read mission audio.", e);
   }
 }
Ejemplo n.º 2
0
 private void readObject(ObjectInputStream in) throws IOException {
   try {
     AliteLog.e("readObject", "TargetBox.readObject");
     in.defaultReadObject();
     AliteLog.e("readObject", "TargetBox.readObject I");
     this.alite = Alite.get();
     initialize();
     AliteLog.e("readObject", "TargetBox.readObject II");
   } catch (ClassNotFoundException e) {
     AliteLog.e("Class not found", e.getMessage(), e);
   }
 }
Ejemplo n.º 3
0
 private void readObject(ObjectInputStream in) throws IOException {
   try {
     AliteLog.e("readObject", "SpaceObject.readObject");
     in.defaultReadObject();
     AliteLog.e("readObject", "SpaceObject.readObject I");
     this.alite = Alite.get();
     exhaust = new ArrayList<EngineExhaust>();
     init();
     AliteLog.e("readObject", "SpaceObject.readObject II");
   } catch (ClassNotFoundException e) {
     AliteLog.e("Class not found", e.getMessage(), e);
   }
 }
Ejemplo n.º 4
0
 public static boolean initialize(Alite alite, DataInputStream dis) {
   try {
     int state = dis.readInt();
     alite.setScreen(new CougarScreen(alite, state));
   } catch (Exception e) {
     AliteLog.e("Cougar Screen Initialize", "Error in initializer.", e);
     return false;
   }
   return true;
 }
Ejemplo n.º 5
0
 public static HackerScreen readScreen(Alite alite, DataInputStream dis) {
   HackerScreen hs = new HackerScreen(alite);
   try {
     dis.read(hs.state.values, 0, 256);
     for (int i = 0; i < 256; i++) {
       hs.values[i].setText(String.format("%02X", hs.state.values[i]));
     }
     hs.yPosition = dis.readInt();
   } catch (Exception e) {
     AliteLog.e("Hacker Screen Initialize", "Error in initializer.", e);
     return null;
   }
   return hs;
 }
Ejemplo n.º 6
0
 public static SpaceObject createRandomEnemy(final Alite alite) {
   int extraShip = ((int) alite.getGenerator().getCurrentSeed()[0] >> 12);
   int type = (int) (Math.random() * 9 + (extraShip == 5 || extraShip == 8 ? 0 : 2));
   AliteLog.d("Ship Statistics", "Returning extraShip == " + extraShip + " -- type == " + type);
   if (type == 9 || type == 10) {
     SpaceObject result = createGalaxyLocalShip(alite, extraShip, type - 9);
     if (result == null) {
       // Fallback routine for galaxy local ships that do not yet exist.
       type = (int) (Math.random() * 9);
     } else {
       return result;
     }
   }
   switch (type) {
     case 0:
       return new Adder(alite);
     case 1:
       return new AspMkII(alite);
     case 2:
       return new BoaClassCruiser(alite);
     case 3:
       return new Gecko(alite);
     case 4:
       return new Krait(alite);
     case 5:
       return new Mamba(alite);
     case 6:
       return new MorayStarBoat(alite);
     case 7:
       return new Sidewinder(alite);
     case 8:
       return new WolfMkII(alite);
     case 9:
       return createGalaxyLocalShip(alite, extraShip, 0);
     case 10:
       return createGalaxyLocalShip(alite, extraShip, 1);
   }
   return new Krait(alite);
 }