48 lines
1.5 KiB
Java
48 lines
1.5 KiB
Java
package ruscz.game.gameOfProd.Cells;
|
|
|
|
import ruscz.game.gameOfProd.Map.Map;
|
|
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
|
|
|
import java.awt.*;
|
|
|
|
public class EventMoveToCell extends Cell {
|
|
private Map map;
|
|
private WindowOfFreeMove window;
|
|
private int id;
|
|
private int directionOut;
|
|
private boolean paint;
|
|
|
|
public int getId(){
|
|
return id;
|
|
}
|
|
|
|
public EventMoveToCell(int id, int directionOut, int x, int y, Map map, WindowOfFreeMove window, boolean paint){
|
|
super(x,y, WindowOfFreeMove.CELL_SIZE, Color.green);
|
|
this.id = id;
|
|
this.directionOut = directionOut;
|
|
this.map = map;
|
|
this.window = window;
|
|
this.paint = paint;
|
|
}
|
|
|
|
public int getDirectionOut() { return directionOut; }
|
|
|
|
public void moveToMap() {
|
|
window.getMapManager().getActualMap().setIdExit(id);
|
|
window.setMapManager(this.map);
|
|
window.getMapManager().getActualMap().setIdExit(id);
|
|
window.paintMapOnWindow();
|
|
window.repaintCanvas();
|
|
window.setCanPersonMove(true);
|
|
}
|
|
|
|
@Override
|
|
public void paint(Graphics2D g) {
|
|
super.paint(g);
|
|
if (paint)
|
|
g.drawImage(window.getMapManager().getActualMap().getImageCell().getImagesOfTiles().get(window.getMapManager().getActualMap().getImageCell().getImageFromCellMap("MOVETO")), getX() * getSize(),
|
|
getY() * getSize(), getSize(), getSize(), null);
|
|
// g.drawString(Integer.toString(getId()), getX()* WindowOfFreeMove.CELL_SIZE, getY()* WindowOfFreeMove.CELL_SIZE);
|
|
}
|
|
}
|