예제 #1
0
 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);
            }
        }
예제 #6
0
 protected override void OnEarthQuake(WeatherEventData weatherData)
 {
     AudioPlayer.PlayOneShot2D(EventType.SFX_DISASTER_EARTHQUAKE_Quake);
 }
예제 #7
0
 protected override void OnEarthQuakeStart(WeatherEventData weatherData)
 {
     earthQuake.start();
 }
예제 #8
0
 protected override void OnStorm(WeatherEventData weatherData)
 {
     AudioPlayer.PlayOneShot2D(EventType.SFX_DISASTER_Thunder);
 }
예제 #9
0
 protected override void OnStormStart(WeatherEventData weatherData)
 {
     rainWind.start();
 }
예제 #10
0
 protected override void OnStormStart(WeatherEventData weatherData)
 {
     SetLightSetting(storm);
 }
 protected virtual void OnEarthQuakeStart(WeatherEventData weatherData)
 {
 }
예제 #12
0
 protected override void OnEarthQuake(WeatherEventData weatherData)
 {
     DecreaseHealth(weatherData);
 }
예제 #13
0
 protected override void OnGasWinning(WeatherEventData weatherData)
 {
     DecreaseHealth(weatherData);
 }
예제 #14
0
        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)
 {
 }
예제 #19
0
 protected override void OnDrought(WeatherEventData weatherData)
 {
     DecreaseHealth(weatherData);
 }
예제 #20
0
 private void DecreaseHealth(WeatherEventData data)
 {
     health.DamageBuilding(data.BuildingTime);
     health.DamageFoundation(data.FoundationTime);
     health.DamageSoil(data.SoilTime);
 }
예제 #21
0
 protected override void OnHeavyRain(WeatherEventData weatherData)
 {
     DecreaseHealth(weatherData);
 }
        protected override void OnEarthQuake(WeatherEventData data)
        {
            CameraMovement(Ehorizontal, eVertical, eFrequency, data.interval);

            VibrationUtil.Vibrate();
        }
예제 #23
0
 protected override void OnStorm(WeatherEventData weatherData)
 {
     DecreaseHealth(weatherData);
 }
 protected virtual void OnHeavyRainStart(WeatherEventData weatherData)
 {
 }
예제 #25
0
 protected override void OnBuildingTunnels(WeatherEventData weatherData)
 {
     DecreaseHealth(weatherData);
 }
예제 #26
0
 protected override void StartWeather(WeatherEventType type, WeatherEventData data)
 {
     StopBackgroundMusic();
     base.StartWeather(type, data);
 }
예제 #27
0
 protected override void StartWeather(WeatherEventType type, WeatherEventData data)
 {
     SetMaterialSettings(weatherSettings[type]);
 }
예제 #28
0
 protected override void OnHeavyRainStart(WeatherEventData weatherData)
 {
     rain.start();
     wind.start();
 }
 protected override void OnStorm(WeatherEventData data)
 {
     CameraMovement(sHorizontal, sVertical, sFrequency, data.interval);
 }
예제 #30
0
 protected override void OnHeavyRainStart(WeatherEventData weatherData)
 {
     SetLightSetting(rainfall);
 }