Coverage Summary for Class: Faction (com.mygdx.game)
Class |
Class, %
|
Method, %
|
Line, %
|
Faction |
100%
(1/1)
|
100%
(7/7)
|
100%
(15/15)
|
1 package com.mygdx.game;
2
3 import com.badlogic.gdx.math.Vector2;
4
5 /**
6 * Represents a faction contains data largly sourced from GameSettings
7 */
8 public class Faction {
9 private String name;
10 private String shipColour;
11 private Vector2 position, spawnPos;
12 public int id = -1;
13
14 public Faction() {
15 name = "Faction not named";
16 shipColour = "";
17 }
18
19 /**
20 * Creates a faction with the specified name, colour, and in-game location.
21 * @param name name of faction
22 * @param colour colour name (used as prefix to retrieve ship sprites)
23 * @param pos 2D vector location
24 */
25 public Faction(String name, String colour, Vector2 pos, Vector2 spawn, int id) {
26 this();
27 this.name = name;
28 this.shipColour = colour;
29 this.position = pos;
30 spawnPos = spawn;
31 this.id = id;
32 }
33
34 /**
35 * @return The name of this Faction
36 */
37 public String getName() {
38 return name;
39 }
40
41 /**
42 * Added for Assessment 2
43 * @return the ID associated with this faction
44 */
45 public int getID() {
46 return id;
47 }
48
49 /**
50 * @return The colour of this Faction
51 */
52 public String getColour() {
53 return shipColour;
54 }
55
56 /**
57 * @return The position of this Faction
58 */
59 public Vector2 getPosition() {
60 return position;
61 }
62
63 /**
64 * @return The spawn position of this Faction
65 */
66 public Vector2 getSpawnPos() {
67 return spawnPos;
68 }
69 }