protected override void StartWeather(WeatherEventType type, WeatherEventData data) { if (enableOnEvent.Contains(type)) { Enable(); } }
protected virtual void StartWeather(WeatherEventType type, WeatherEventData data) { switch (type) { case WeatherEventType.Drought: OnDroughtStart(data); break; case WeatherEventType.HeavyRain: OnHeavyRainStart(data); break; case WeatherEventType.Earthquake: OnEarthQuakeStart(data); break; case WeatherEventType.Storm: OnStormStart(data); break; case WeatherEventType.GasWinning: OnGasWinningStart(data); break; case WeatherEventType.BuildingTunnels: OnBuildingTunnelsStart(data); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
private WeatherEventData GetData(WeatherEventType weatherEventType) { for (int i = 0; i < eventDataPerEventType.Count; i++) { if (eventDataPerEventType[i].Key == weatherEventType) { WeatherEventData data = eventDataPerEventType[i].Value; abstractWeatherEvent = WeatherEventInstanceCreator.CreateInstance(weatherEventType, data); return(data); } } throw new NullReferenceException("No Data found for " + weatherEventType); }
private void LoadData() { GameData gameData = UserSettings.GameData; weatherEventType = gameData.WeatherEventType; if (weatherEventType == (WeatherEventType)(-1)) { return; } weatherEventData = GetData(weatherEventType); weatherEventTimer.StartTimer(weatherEventData.Timer, EndWeatherEvent, weatherEventType); weatherEventTimer.Timer = gameData.TimerWeatherEvent; weatherEventActive = true; EventManager.Instance.RaiseEvent(new StartWeatherEvent(abstractWeatherEvent, false)); }
private void TimerToNextWeatherEvent() { timerTillNextEvent -= Time.unscaledDeltaTime; if (timerTillNextEvent <= 0.0f && !PowerUpManager.Instance.AvoidWeatherActive) { if (TimeManager.Instance.IsPaused() || TutorialManager.IsActive) { return; } weatherEventType = GetRandomWeather(); weatherEventData = GetData(weatherEventType); EventManager.Instance.RaiseEvent(new StartWeatherEvent(abstractWeatherEvent)); weatherEventTimer.StartTimer(weatherEventData.Timer, EndWeatherEvent, weatherEventType); EnableEventScreen(true); weatherEventActive = true; timerTillNextEvent = Random.Range(minTime, maxTime); } }
protected override void OnEarthQuake(WeatherEventData weatherData) { AudioPlayer.PlayOneShot2D(EventType.SFX_DISASTER_EARTHQUAKE_Quake); }
protected override void OnEarthQuakeStart(WeatherEventData weatherData) { earthQuake.start(); }
protected override void OnStorm(WeatherEventData weatherData) { AudioPlayer.PlayOneShot2D(EventType.SFX_DISASTER_Thunder); }
protected override void OnStormStart(WeatherEventData weatherData) { rainWind.start(); }
protected override void OnStormStart(WeatherEventData weatherData) { SetLightSetting(storm); }
protected virtual void OnEarthQuakeStart(WeatherEventData weatherData) { }
protected override void OnEarthQuake(WeatherEventData weatherData) { DecreaseHealth(weatherData); }
protected override void OnGasWinning(WeatherEventData weatherData) { DecreaseHealth(weatherData); }
public static AbstractWeatherEvent CreateInstance(WeatherEventType eventType, WeatherEventData weatherEventData) { GameObject gameObject = new GameObject(eventType.ToString()); AbstractWeatherEvent abstractWeatherEvent = AddWeatherComponent(eventType, gameObject); abstractWeatherEvent.WeatherEventData = weatherEventData; return(abstractWeatherEvent); }
// Start Weather protected virtual void OnDroughtStart(WeatherEventData weatherData) { }
protected virtual void OnBuildingTunnelsStart(WeatherEventData weatherData) { }
protected virtual void OnGasWinningStart(WeatherEventData weatherData) { }
protected virtual void OnStormStart(WeatherEventData weatherData) { }
protected override void OnDrought(WeatherEventData weatherData) { DecreaseHealth(weatherData); }
private void DecreaseHealth(WeatherEventData data) { health.DamageBuilding(data.BuildingTime); health.DamageFoundation(data.FoundationTime); health.DamageSoil(data.SoilTime); }
protected override void OnHeavyRain(WeatherEventData weatherData) { DecreaseHealth(weatherData); }
protected override void OnEarthQuake(WeatherEventData data) { CameraMovement(Ehorizontal, eVertical, eFrequency, data.interval); VibrationUtil.Vibrate(); }
protected override void OnStorm(WeatherEventData weatherData) { DecreaseHealth(weatherData); }
protected virtual void OnHeavyRainStart(WeatherEventData weatherData) { }
protected override void OnBuildingTunnels(WeatherEventData weatherData) { DecreaseHealth(weatherData); }
protected override void StartWeather(WeatherEventType type, WeatherEventData data) { StopBackgroundMusic(); base.StartWeather(type, data); }
protected override void StartWeather(WeatherEventType type, WeatherEventData data) { SetMaterialSettings(weatherSettings[type]); }
protected override void OnHeavyRainStart(WeatherEventData weatherData) { rain.start(); wind.start(); }
protected override void OnStorm(WeatherEventData data) { CameraMovement(sHorizontal, sVertical, sFrequency, data.interval); }
protected override void OnHeavyRainStart(WeatherEventData weatherData) { SetLightSetting(rainfall); }