float pointY = Float.parseFloat(st.nextToken());
boolean isStatic = Boolean.parseBoolean(st.nextToken());
String type = st.nextToken();
int cpt = Integer.parseInt(st.nextToken());
try {
Item it = ((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).getInventory().peek();
if (!type.equals("null")) {
if (it == null) {
((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).getInventory().setNextItem(type, cpt);
}
} else {
((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).getInventory().deleteAll();
((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).getInventory().updateMiniatures();
}
((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).setSparklingPosition(new Vector2D(pointX, pointY), isStatic);
((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).setColliding(isColliding);
Singleton.getPhysics().setLinearVelocity(actorName, new Vector2D(velX, velY));
Singleton.getPhysics().setBodyPosition(actorName, new Vector2D(posX, posY));
Singleton.getPhysics().setRotation(actorName, rot);
if (!((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).getPowerDown() && isPoweredDown) {
((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).applyPowerDown();
} else if (((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).getPowerDown() && !isPoweredDown) {
((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).deletePowerDown();
}
if (!((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).getBoost() && isBoosted) {
((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).applyBoost();
} else if (((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).getBoost() && !isBoosted) {
((RaceGameState) Singleton.getWorldModel().getState()).getCars().get(i).deleteBoost();
}
} catch (NullPointerException e) {
System.out.println("error update actor");
}
}
//Update missilesingleton.getWorldModel().
Set<String> currentItemList = ((RaceGameState) Singleton.getWorldModel().getState()).getWorldEntities().keySet();
ArrayList<String> newItemList = new ArrayList();
ArrayList<String> currentMissileList = new ArrayList();
ArrayList<String> currentBombList = new ArrayList();
ArrayList<String> currentMineList = new ArrayList();
ArrayList<String> currentDynamicObjectList = new ArrayList();
for (String it : currentItemList) {
if (it.startsWith("Missile_") && !it.endsWith("_Explosion")) {
currentMissileList.add(it);
} else if (it.startsWith("Bomb_") && !it.endsWith("_Explosion")) {
currentBombList.add(it);
} else if (it.startsWith("Mine_") && !it.endsWith("_Explosion")) {
currentMineList.add(it);
} else if (it.startsWith("dynamic")) {
currentDynamicObjectList.add(it);
}
}