Package com.aqpproject.worldmodel.data

Source Code of com.aqpproject.worldmodel.data.Mine

/*
* 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.WEMine;
import com.aqpproject.worldmodel.game.state.RaceGameState;

/**
*
* @author admlatterner
*/
public class Mine extends Item {

    public Mine(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 = "Mine_" + 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 WEMine(name, pos, car.getRotation(), car, state));
        }
    }
}
TOP

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

TOP
Copyright © 2018 www.massapi.com. 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.