예제 #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));
 }
예제 #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;
 }
예제 #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();
   }
 }
예제 #4
0
 public void setIntensity(Intensity in) {
   weather.getSky().getData().put(VanillaData.STORM_INTENSITY, in != null ? in.ordinal() : -1);
 }