/*
* AQP Project
* http://http://code.google.com/p/aqp-project/
* Alexandre Gomez - Clément Troesch - Fabrice Latterner
*/
package com.aqpproject.worldmodel.data;
import com.aqpproject.game.Singleton;
import com.aqpproject.tools.Vector2D;
import com.aqpproject.worldmodel.ItemType;
import com.aqpproject.worldmodel.game.entity.WEBomb;
import com.aqpproject.worldmodel.game.entity.WECar;
import com.aqpproject.worldmodel.game.state.RaceGameState;
/**
*
* @author admlatterner
*/
public class Bomb extends Item {
public Bomb(String name, String spriteName, Vector2D position, float rotation, int frame, ItemType type) {
super(name, spriteName, position, rotation, frame, type);
}
@Override
public void action(RaceGameState state, WECar car) {
if (Singleton.getOptionsController().getRole().equals("SERVER")) {
String name = "Bomb_" + car + "_" + Singleton.getWorldModel().getTime();
Vector2D pos = car.getCenter();
pos.translate(car.getDirection().scale(-16 + 64));
pos.translate(car.getRight().scale(16));
state.getWorldEntities().put(name, new WEBomb(name, pos, car.getRotation(), car, state));
}
}
}