Exemplo n.º 1
0
 /**
  * Gets the strength of the thunder storm, which is affected by the duration
  *
  * @param factor to apply to the changing states
  * @return the strength
  */
 public float getThunderStrength(float factor) {
   float currentThunderStrength =
       weather.getSky().getData().get(VanillaData.CURRENT_LIGHTNING_STRENGTH);
   float previousThunderStrength =
       weather.getSky().getData().get(VanillaData.PREVIOUS_LIGHTNING_STRENGTH);
   return (previousThunderStrength + factor * (currentThunderStrength - previousThunderStrength));
 }
Exemplo n.º 2
0
 public Intensity getIntensity() {
   int intensity = weather.getSky().getData().get(VanillaData.STORM_INTENSITY);
   if (intensity >= 0 && intensity < Intensity.values().length) {
     return Intensity.values()[intensity];
   }
   return null;
 }
Exemplo n.º 3
0
 @Override
 public void onTick(float dt) {
   float currentThunderStrength =
       weather.getSky().getData().get(VanillaData.CURRENT_LIGHTNING_STRENGTH);
   weather.getSky().getData().put(VanillaData.PREVIOUS_LIGHTNING_STRENGTH, currentThunderStrength);
   if (this.weather.isThundering()) {
     currentThunderStrength = Math.min(1.0f, currentThunderStrength + 0.01f);
   } else {
     currentThunderStrength = Math.max(0.0f, currentThunderStrength - 0.01f);
   }
   weather.getSky().getData().put(VanillaData.CURRENT_LIGHTNING_STRENGTH, currentThunderStrength);
   try {
     updatePlayerTimers();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Exemplo n.º 4
0
 public void setIntensity(Intensity in) {
   weather.getSky().getData().put(VanillaData.STORM_INTENSITY, in != null ? in.ordinal() : -1);
 }