/** * Adds an entity to the manager. This will be done when a new entity is created. * * @param u The entity that is to be added. */ public void add(InteractiveEntity entity) { entity.setPlayerID(myPlayer); entity.addObserver(GameState.getMap().getNodeMap()); entity.addObserver(this); entity.setChanged(); entity.notifyObservers(entity.getWorldLocation()); myAddQueue.add(entity); }
/** * Adds items to the manager. These items will then be observed by the NodeMap and will be updated * and painted every cycle. * * @param gs The item to add */ public void add(T gs) { gs.addObserver(GameState.getMap().getNodeMap()); gs.setChanged(); gs.notifyObservers(gs.getWorldLocation()); myGameSprites.add(gs); }