1 package se
.umu
.cs
.dit06ajnajs
.map
;
4 import se
.umu
.cs
.dit06ajnajs
.agent
.Unit
;
5 import java
.util
.logging
.Logger
;
6 import se
.umu
.cs
.dit06ajnajs
.agent
.Direction
;
7 import java
.awt
.Graphics
;
9 import se
.umu
.cs
.dit06ajnajs
.AntiTD
;
10 import java
.util
.Observer
;
11 import java
.util
.Observable
;
13 public class StartSquare
extends MapSquare
implements Traversable
, Observer
{
14 private static Logger logger
= Logger
.getLogger("AntiTD");
15 private boolean active
= false;
17 // TODO, set startDirection dynamicly
18 private Direction startDirection
= Direction
.UP
;
20 public StartSquare(int x
, int y
, Image image
) {
24 public boolean isActive() {
28 public void setActive(boolean active
) {
32 public void landOn(Unit unit
) {
33 // TODO copied from GoalSquare, how do we implement a starting Unit?
35 unit
.setDirection(startDirection
);
39 * Sets this StartSquare as active.
52 public void paint(Graphics g
) {
55 g
.setColor(Color
.GREEN
);
56 g
.drawRect(getX(), getY(),
57 AntiTD
.SQUARE_SIZE
- 1, AntiTD
.SQUARE_SIZE
- 1);
58 g
.drawRect(getX() - 1, getY() - 1,
59 AntiTD
.SQUARE_SIZE
- 2, AntiTD
.SQUARE_SIZE
- 2);
64 * Called when another StartSquare is activated, which means that this
65 * StartSquare should not be active.
67 * @param observer an <code>Observable</code> value
68 * @param obj an <code>Object</code> value
70 public void update(Observable observer
, Object obj
) {
71 logger
.info("Update in StartSquare: active is set to false");