-
Notifications
You must be signed in to change notification settings - Fork 0
/
BeamType.java
50 lines (39 loc) · 1.17 KB
/
BeamType.java
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
import java.util.Random;
enum BeamType {
FAR(1.0f, 0.1f, 3.0f, 0.5f, 5.0f),
MIDDLE(2.0f, 0.2f, 6.0f, 0.7f, 7.0f),
NEAR(3.0f, 0.3f, 9.0f, 0.9f, 9.0f);
private static final BeamType[] VALUES = BeamType.values();
private static final Random RANDOM = new Random();
private static final int OPAQUE = 255;
private final float mVelocity;
private final float mAcceleration;
private final float mTerminalVelocity;
private final float mAlpha;
private final float mSize;
BeamType(float velocity, float acceleration, float terminalVelocity, float alpha, float size) {
mVelocity = velocity;
mAcceleration = acceleration;
mTerminalVelocity = terminalVelocity;
mAlpha = alpha * OPAQUE;
mSize = size;
}
static BeamType getRandomBeamType() {
return VALUES[RANDOM.nextInt(VALUES.length)];
}
float getVelocity() {
return mVelocity;
}
float getAcceleration() {
return mAcceleration;
}
float getTerminalVelocity() {
return mTerminalVelocity;
}
float getAlpha() {
return mAlpha;
}
float getSize() {
return mSize;
}
}