Team: Malcolm Reynolds, Zoë Washburne, Inara Serra, Jayne Cobb Project: Tower Defense UML Diagram: TowerDefense TowerDefense Model TowerDefense ModelTest Enemy Location Tower EnemyTest LocationTest TowerTest Classes: TowerDefense is the GUI for the game. Its methods include: • draw draws the current state of the game • handleMouseClick gets a mouse click from the user • run runs the game TowerDefenseModel is the logical model of the game. It contains all enemies and towers, the player’s score and money. • advance updates the model for one time step • createTower creates a tower at a specific location, assuming the player has enough money • getEnemies returns an ArrayList of all enemies • getLives returns the number of lives the player has • getMoney returns the amount of money the player has • • • • getNextPosition returns the next location of an enemy, along the shortest path to the right edge of the map; we put this here, rather than in Enemy, because the path finding algorithm needs to know the locations of the towers and other enemies getScore returns the player’s score getTarget returns the enemy, if any, that a particular tower will shoot at; this is needed for deciding where to draw laser beams getTowers returns an ArrayList of all towers Enemy represents an enemy. • damage reduces the enemy’s health by one and returns true if this destroys the enemy • getHealth returns the enemy’s remaining health • getLocation returns the enemy’s current location • move moves the enemy to a new location Tower represents a tower. • charge increments this tower’s charge (up to a maximum of 3) • fire reduces this tower’s charge to 0 • getLocation returns the tower’s location • isCharged returns true if this tower is able to fire Location is an x/y location on the map. This simple class has getters and setters for its two fields, x and y. It also has a method distanceTo, that returns the distance to another location. The remaining classes are test classes. We will write many tests of individual methods such as getters and setters. The trickier tests will involve the advance and createTower methods in TowerDefenseModel: • Do enemies correctly choose the shortest path? • Do towers shoot at the right enemies? • Do towers only fire when they are fully charged? • Do enemies die exactly when they should? • Are points and money updated when an enemy dies? • Are lives decremented when an enemy gets to the right edge of the map? • Does the game end when the player runs out of lives? • Does tower creation in fact create a tower? • It is impossible to create a tower on an unoccupied spot? • Is it impossible to create a tower that completely blocks off all paths between the left and right edges? • Is it impossible to create a tower if the player does not have enough money?