-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTechnologyAndInnovation.java
More file actions
executable file
·51 lines (47 loc) · 1.48 KB
/
TechnologyAndInnovation.java
File metadata and controls
executable file
·51 lines (47 loc) · 1.48 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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* TechnologyAndInnovation class
*
* @author Jimmy, Adrian, Daniel
* @version (a version number or a date)
*/
public class TechnologyAndInnovation extends Industry {
private int SI = +2;
private int EPR = +3;
private int CWI = +3;
private int type = 6;
public TechnologyAndInnovation() {
super(+2, +3, +3, 6);
L1 = new GreenfootImage("images/industry/Technology1.png");
L2 = new GreenfootImage("images/industry/Technology2.png");
L3 = new GreenfootImage("images/industry/Technology3.png");
}
/**
* Act - do whatever the TechnologyAndInnovation wants to do. This method is called whenever the
* 'Act' or 'Run' button gets pressed in the environment.
*/
public void act() {
checkNextLevel();
checkImage();
}
/** Checks if it can level up based on the criteria */
public void checkNextLevel() {
if (MainWorld.getTotalCoin() >= 2500 && level == 0) {
levelUp();
MainWorld.changeTotalCoin(-2500);
MainWorld.changeEPR(3);
} else if (MainWorld.getTotalCoin() >= 3750 && level == 1) {
levelUp();
MainWorld.changeTotalCoin(-3750);
MainWorld.changeEPR(2);
MainWorld.changeSI(1);
} else if (MainWorld.getTotalCoin() >= 1875
&& level == 2
&& MainWorld.getIndustryLevel(2) >= 2) {
levelUp();
MainWorld.changeTotalCoin(-1875);
MainWorld.changeEPR(1);
MainWorld.changeCWI(1);
}
}
}