-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWorldEntity.java
More file actions
68 lines (57 loc) · 1.24 KB
/
WorldEntity.java
File metadata and controls
68 lines (57 loc) · 1.24 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
/*
* WorldEntity.java
* Project Disconnect
*
* Created by Drew Malin on 8/27/2011.
* Copyright 2011 Drew Malin. All rights reserved.
*
*/
public abstract class WorldEntity {
public int id;
public float position[];
public float rotation[];
public String name;
public int colorID[];
public WorldEntity() {
position = new float[3];
rotation = new float[3];
colorID = new int[3];
}
public abstract void draw();
public void setName(String name) {
this.name = name;
}
public void setColorID(int R, int G, int B) {
colorID[0] = R;
colorID[1] = G;
colorID[2] = B;
}
public void setPositionArray(float x, float y, float z) {
position[0] = x;
position[1] = y;
position[2] = z;
}
public float getPosition(int index) {
assert ((index >= 0) && index <3);
return position[index];
}
public void changePositionX(float delta) {
position[0] += delta;
}
public void changePositionY(float delta) {
position[1] += delta;
}
public void changePositionZ(float delta) {
position[2] += delta;
}
public String getName() {
return name;
}
public float getRotation(int index) {
assert ((index >= 0) && index <3);
return rotation[index];
}
public void changeRotationY(float a) {
rotation[1] += a;
}
}