Package com.aqpproject.worldmodel.data

Examples of com.aqpproject.worldmodel.data.Item


                    boolean isPoweredDown = car_list.get(i - 1).getPowerDown();
                    boolean isBoosted = car_list.get(i - 1).getBoost();
                    boolean isColliding = car_list.get(i - 1).getColliding();
                    boolean isStatic = car_list.get(i - 1).getIsStaticContact();
                    Vector2D point = car_list.get(i - 1).getContactPoint();
                    Item it = car_list.get(i - 1).getInventory().peek();
                    String type;
                    Integer num_item;

                    if (it == null) {
                        type = "null";
                        num_item = 0;
                    } else {
                        type = it.getType().toString();
                        switch (type) {
                            case "BOMB":
                                type = "Bomb";
                                break;
                            case "MISSILE":
                                type = "Missile";
                                break;
                            case "MINE":
                                type = "Mine";
                                break;
                            case "POWERDOWN":
                                type = "PowerDown";
                                break;
                            case "BOOST":
                                type = "Boost";
                                break;
                            case "TROLL":
                                type = "Troll";
                                break;
                        }
                        num_item = Integer.parseInt(it.getName().substring(4));

                    }
                    theOutput += ";" + name + ";" + posX + ";" + posY + ";" + rot + ";" + velX + ";" + velY + ";" + isPoweredDown + ";" + isBoosted + ";" + isColliding + ";" + point.x + ";" + point.y + ";" + isStatic + ";" + type + ";" + num_item;
                }
                WECar troll_emitter = ((RaceGameState) Singleton.getWorldModel().getState()).getTrollEmitter();
View Full Code Here


            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);
            }
        }

View Full Code Here

        m_controller = Ic;
        m_lastTime = -1 * Ic.getDelay();
    }

    public Item getItem() {
        Item item = null;
        if (Singleton.getOptionsController().getRole().equals("SERVER")) {
            item = m_currentItem;
        }
        m_currentItem = null;
        m_lastTime = Singleton.getWorldModel().getTime();
View Full Code Here

TOP

Related Classes of com.aqpproject.worldmodel.data.Item

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.