Comments added to GateDrawer.java

This commit is contained in:
Siket Melinda Tekla 2016-05-16 16:29:47 +02:00
parent 361569ad7c
commit f8a0057ff4
1 changed files with 33 additions and 0 deletions

View File

@ -2,14 +2,32 @@ package cicaprojekt;
import java.io.IOException; import java.io.IOException;
/**
* Egy kapu kirajzolásáért felelős osztály.
*/
public class GateDrawer extends AbstractDrawer { public class GateDrawer extends AbstractDrawer {
/**
* Egy kapupéldány, amelyet kirajzolunk.
*/
private Gate gate; private Gate gate;
/**
* A kapott kapupéldányhoz kirajzol egy kaput.
*
* @param g a kapott kapupéldány
* @throws IOException Ha nem található a kép.
*/
public GateDrawer(Gate g) throws IOException { public GateDrawer(Gate g) throws IOException {
super("Gate.png"); super("Gate.png");
gate = g; gate = g;
} }
/**
* A kapu képét megváltoztatja annak megfelelően, hogy csukva van,
* nyitva, illetve van-e rajta doboz.
*
* @throws IOException Ha nem találhatóak a képek.
*/
@Override @Override
public void draw() throws IOException { public void draw() throws IOException {
if(gate.isOpen()) { if(gate.isOpen()) {
@ -22,16 +40,31 @@ public class GateDrawer extends AbstractDrawer {
changeImage("Gate.png"); changeImage("Gate.png");
} }
/**
* A kapu x-koordinátájával tér vissza.
*
* @return x-koordináta
*/
@Override @Override
public int getTileX() { public int getTileX() {
return gate.getX(); return gate.getX();
} }
/**
* A kapu y-koordinátájával tér vissza.
*
* @return y-koordináta
*/
@Override @Override
public int getTileY() { public int getTileY() {
return gate.getY(); return gate.getY();
} }
/**
* Átállítja a kapott <code>Gate</code>-re a kirajzolandó kaput.
*
* @param gate a kapott kapu
*/
public void setGate(Gate gate) { public void setGate(Gate gate) {
this.gate = gate; this.gate = gate;
} }