-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathData.java
More file actions
72 lines (65 loc) · 2.15 KB
/
Data.java
File metadata and controls
72 lines (65 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import java.util.ArrayList;
/**
* This class holds data that has been processed by
* the DataProcessor. It allows for primarily the
* player to easily reference data necessary for
* updating their game state
*
* @see DataProcessor
*/
public class Data {
// player
public Ship spaceship;
// player's projectiles
public ArrayList<Projectile> projectiles;
// list of asteroids
public ArrayList<Asteroid> asteroids;
/**
* Creates a new Data object only containing the asteroids
* of the current game state
*
* @param asteroids the objects of the asteroids from the
* player sending data
*/
public Data(ArrayList<Asteroid> asteroids) {
this.asteroids = asteroids;
}
/**
* Creates a new Data object only containing the sending
* player's Ship and associated Projectiles.
*
* @param spaceship the object of the player sending data
* @param projectiles the objects of the projectiles from the
* player sending data
*/
public Data(Ship spaceship, ArrayList<Projectile> projectiles) {
this.spaceship = spaceship;
this.projectiles = projectiles;
}
/**
* Creates a new Data object containing the sending player's
* Ship, associated Projectiles, and current Asteroids
* iteration.
*
* @param player the object of the player sending data
* @param projectiles the objects of the projectiles from the
* player sending data
* @param asteroids the objects of the current asteroids
* present in the universe
*/
public Data(Ship spaceship,
ArrayList<Projectile> projectiles,
ArrayList<Asteroid> asteroids) {
this.spaceship = spaceship;
this.projectiles = projectiles;
this.asteroids = asteroids;
}
/* public String toString() {
String data = "";
data += player.toString() + "\n";
for (Projectile p : projectiles) data += p.toString() + "\n";
for (Asteroid a : asteroids) data += a.toString() + "\n";
return data.trim();
}
*/
}