Minor Engine opt

This commit is contained in:
CovertJaguar 2013-05-01 17:35:37 -07:00
parent 4361db859c
commit e980637f7e
2 changed files with 9 additions and 7 deletions

View file

@ -46,13 +46,14 @@ public abstract class Engine {
}
protected void computeEnergyStage() {
if (energy / (double) maxEnergy * 100.0 <= 25.0) {
double level = energy / (double) maxEnergy * 100.0;
if (level <= 25.0) {
energyStage = EnergyStage.Blue;
} else if (energy / (double) maxEnergy * 100.0 <= 50.0) {
} else if (level <= 50.0) {
energyStage = EnergyStage.Green;
} else if (energy / (double) maxEnergy * 100.0 <= 75.0) {
} else if (level <= 75.0) {
energyStage = EnergyStage.Yellow;
} else if (energy / (double) maxEnergy * 100.0 <= 100.0) {
} else if (level <= 100.0) {
energyStage = EnergyStage.Red;
} else {
energyStage = EnergyStage.Explosion;

View file

@ -42,11 +42,12 @@ public class EngineWood extends Engine {
@Override
protected void computeEnergyStage() {
if (energy / (double) maxEnergy * 100.0 <= 25.0) {
double level = energy / (double) maxEnergy * 100.0;
if (level <= 25.0) {
energyStage = EnergyStage.Blue;
} else if (energy / (double) maxEnergy * 100.0 <= 50.0) {
} else if (level <= 50.0) {
energyStage = EnergyStage.Green;
} else if (energy / (double) maxEnergy * 100.0 <= 75.0) {
} else if (level <= 75.0) {
energyStage = EnergyStage.Yellow;
} else {
energyStage = EnergyStage.Red;