Add a tower on a random towersquare
[AntiTD.git] / src / se / umu / cs / dit06ajnajs / ATDModel.java
blob5f318e102c36a13a5e13563e5db545b718a14d52
1 package se.umu.cs.dit06ajnajs;
4 import java.awt.Dimension;
5 import java.awt.Image;
6 import java.awt.Point;
7 import java.util.ArrayList;
8 import java.util.List;
9 import se.umu.cs.dit06ajnajs.agent.Agent;
10 import se.umu.cs.dit06ajnajs.agent.Tower;
13 public class ATDModel {
14 Player player;
15 List<Agent> agents;
16 Map map;
18 public ATDModel() {
19 this.agents = new ArrayList<Agent>();
20 this.map = MapBuilder.createMap();
23 public void addTower(Tower t) {
24 TowerSquare square = map.getRandomFreeTowerSquare();
25 if (square != null) {
26 Point p = square.getPosition();
27 t.setPostition(p);
28 square.setTower(t);
29 agents.add(t);
30 } else {
31 System.out.println("No available towersquares");
35 public void addAgent(Agent agent) {
36 // TODO Auto-generated method stub
37 agents.add(agent);
40 public List<Agent> getAgents() {
41 // TODO Auto-generated method stub
42 return this.agents;
45 public Map getMap() {
46 return this.map;
49 public Image getMapImage() {
50 return map.getMapImage();
53 public Dimension getMapDimension() {
54 return map.getDimension();