/*
* 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.WECar;
import com.aqpproject.worldmodel.game.entity.WorldEntity;
import com.aqpproject.worldmodel.game.state.RaceGameState;
import java.util.HashMap;
/**
*
* @author admlatterner
*/
public class PowerDown extends Item {
public PowerDown(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) {
//car.applyPowerDown();
if (Singleton.getOptionsController().getRole().equals("SERVER")) {
HashMap<String, WorldEntity> entities = state.getWorldEntities();
for (String s : entities.keySet()) {
WorldEntity e = entities.get(s);
if (e instanceof WECar && e != car) {
WECar c = (WECar) e;
c.applyPowerDown();
}
}
}
}
}