Coverage Summary for Class: FireTruckType (com.mozarellabytes.kroy.Entities)
Class | Class, % | Method, % | Line, % |
---|---|---|---|
FireTruckType | 100% (1/ 1) | 66.7% (8/ 12) | 82.6% (19/ 23) |
1 package com.mozarellabytes.kroy.Entities;
2
3 import com.badlogic.gdx.Gdx;
4 import com.badlogic.gdx.graphics.Color;
5 import com.badlogic.gdx.graphics.Texture;
6
7 /**
8 * FireTruckType is an enum defining the trucks that can be present in the game.
9 * Each truck type has a unique reserve, speed, trail colour, range, and attack points.
10 * This allows there to be numerous different types of FireTrucks and numerous trucks
11 * of each type without having to randomly generate values which may make the game
12 * unplayable in some instances and too easy in other instances.
13 */
14
15 public enum FireTruckType {
16
17 /** The preset values for the different truck types includes the type's:
18 * maximum reserve, speed, trailColour, name, attack range, attack points
19 */
20 Speed(100, 2, Color.RED, "Speed Truck", 5, 0.08f, 150),
21 Ocean(250, 1, Color.CYAN, "Ocean Truck", 7, 0.16f, 100);
22
23 /** The maximum amount of water this type of truck can have,
24 * also the value of the truck's reserve when it is spawned */
25 private final float maxReserve;
26
27 /** The maximum amount of health points this type of truck can have,
28 * also the value of the truck's health points when it is spawned */
29 private final float maxHP;
30
31 /** The speed at which this type of truck moves around the map */
32 private final float speed;
33
34 /** The colour of the trail that is visible once a truck's path has
35 * been drawn */
36 private final Color trailColour;
37
38 /** The name of this type of truck */
39 private final String name;
40
41 /** The attack range of this type of truck */
42 private final float range;
43
44 /** Attack points - the damage this truck can inflict */
45 private final float AP;
46
47 /** The tile sprite that is drawn to GameScreen once a truck's
48 * path has been drawn */
49 private final Texture trailImage;
50
51 /** The tile sprite that marks the end of the truck's path so the
52 * user knows which tile they can continue drawing the truck's
53 * path from */
54 private final Texture trailImageEnd;
55
56 /**
57 * Constructs the FireTruckType
58 *
59 * @param maxReserve The maximum reserve for this type of truck;
60 * @param speed The speed of this type of truck
61 * @param trailColour The colour of the truck's path when it has been drawn
62 * @param name The name for this type of truck
63 * @param range The attack range for this type of truck in tiles
64 * @param AP the attack points for this type of truck
65 *
66 */
67 FireTruckType(int maxReserve, int speed, Color trailColour, String name, float range, float AP, float maxHP) {
68 this.maxReserve = maxReserve;
69 this.maxHP = maxHP;
70 this.speed = speed;
71 this.trailColour = trailColour;
72 this.name = name;
73 this.range = range;
74 this.AP = AP;
75
76 this.trailImage = new Texture(Gdx.files.internal("sprites/firetruck/trail.png"));
77 this.trailImageEnd = new Texture(Gdx.files.internal("sprites/firetruck/trailEnd.png"));
78 }
79
80 public float getMaxReserve(){ return this.maxReserve; }
81
82 public float getMaxHP(){ return this.maxHP; }
83
84 public float getSpeed(){ return this.speed; }
85
86 public Color getTrailColour() { return this.trailColour; }
87
88 public String getName() { return this.name; }
89
90 public float getRange() { return this.range; }
91
92 public float getAP() { return this.AP; }
93
94 public Texture getTrailImage(){ return this.trailImage; }
95
96 public Texture getTrailImageEnd() { return this.trailImageEnd; }
97
98 }