예제 #1
0
        public void SetWeather(WeatherZone weatherZone, WeatherType type, float intensity)
        {
            weatherZone.CurrentWeather = type;
            weatherZone.Intensity = intensity;

            this.SendWeather(weatherZone);
        }
예제 #2
0
 public WeatherDescription(WeatherType type, double temperature, string description, string icon = null)
 {
     Type        = type;
     Temperature = temperature;
     Description = description;
     Icon        = icon;
 }
예제 #3
0
    private void Update()
    {
        if (_lastWeather != currentWeather && WorldManager.Instance.Active)
        {
            _lastWeather = currentWeather;
            switch (currentWeather)
            {
            case WeatherType.Clear:
                clouds.SetActive(false);
                rainyClouds.SetActive(false);
                break;

            case WeatherType.Cloudy:
                clouds.SetActive(true);
                rainyClouds.SetActive(false);
                break;

            case WeatherType.Rainy:
                rainyClouds.SetActive(true);
                break;

            default:
                Debug.Log("Unknown weather type set");
                return;
            }
        }
    }
예제 #4
0
 public Weather(WeatherType type, string description, DateTime date, int planetPosition)
 {
     Type           = type;
     Description    = description;
     Date           = date;
     PlanetPosition = planetPosition;
 }
        public StoredWeather Create(IWeather weather, string message, WeatherType type, int daysAhead)
        {
            var forecast = new StoredWeather();

            switch (type)
            {
            case WeatherType.Current:
                CurrentWeather currentWeather = weather as CurrentWeather;
                forecast.CityId       = currentWeather.Id;
                forecast.QueryDate    = DateTime.Now;
                forecast.RequiredDate = DateTime.Now;
                forecast.Type         = WeatherType.Current;
                forecast.Message      = message;
                break;

            case WeatherType.Forecast:
                WeatherForecast weatherForecast = weather as WeatherForecast;
                forecast.CityId       = weatherForecast.City.Id;
                forecast.QueryDate    = DateTime.Now;
                forecast.RequiredDate = DateTime.Now.AddDays(daysAhead);
                forecast.Type         = WeatherType.Forecast;
                forecast.Message      = message;
                break;
            }

            return(forecast);
        }
        private void SetWeather(WeatherType newWeather)
        {
            switch (newWeather)
            {
            case WeatherType.DAY:
                rain.SetActive(false);
                UpdateValues(0.5f, 0f, 1f, 1f);
                break;

            case WeatherType.NIGHT:
                rain.SetActive(false);
                UpdateValues(0f, 0.5f, 0f, 0f);
                break;

            case WeatherType.RAIN:
                rain.SetActive(true);
                nextThunder = Time.time + Random.Range(thunderTimeMin, thunderTimeMax);
                UpdateValues(0f, 0.35f, 0.05f, 0.068f);
                break;

            case WeatherType.CUSTOM:
                break;

            default:
                break;
            }

            currentWeather = newWeather;
        }
예제 #7
0
        public async Task <IActionResult> Create(AddMealViewModel addMealViewModel)
        {
            if (ModelState.IsValid)
            {
                WeatherType   newWeatherType      = _context.WeatherTypes.Single(w => w.ID == addMealViewModel.WeatherTypeID);
                CookingMethod newCookingMethod    = _context.CookingMethods.Single(m => m.ID == addMealViewModel.CookingMethodID);
                CookingMethod newAltCookingMethod = _context.CookingMethods.Single(a => a.ID == addMealViewModel.AltCookingMethodID);
                CookingTime   newCookingTime      = _context.CookingTimes.Single(t => t.ID == addMealViewModel.CookingTimeID);
                PrepTime      newPrepTime         = _context.PrepTimes.Single(p => p.ID == addMealViewModel.PrepTimeID);

                //Add the new default meal to the default meal table
                Meal newMeal = new Meal
                {
                    Name             = addMealViewModel.Name,
                    Description      = addMealViewModel.Description,
                    Location         = addMealViewModel.Location,
                    UserID           = addMealViewModel.UserID,
                    WeatherType      = newWeatherType,
                    CookingMethod    = newCookingMethod,
                    AltCookingMethod = newAltCookingMethod,
                    CookingTime      = newCookingTime,
                    PrepTime         = newPrepTime
                };

                _context.Meals.Add(newMeal);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(addMealViewModel));
        }
예제 #8
0
 public WeatherZone(int ZoneID)
 {
     Seasons        = new WeatherSeasonChances[4];
     CurrentWeather = WeatherType.WEATHER_FINE;
     Intensity      = 0f;
     this.ZoneID    = ZoneID;
 }
예제 #9
0
 static void RaiseOnWeatherChangeEvent(WeatherType weather)
 {
     if (OnWeatherChange != null)
     {
         OnWeatherChange(weather);
     }
 }
예제 #10
0
 private WeatherEvent(DateTime dateTime, WeatherType type)
 {
     this.Date = dateTime.Date;
     this.Time = dateTime.TimeOfDay;
     Type      = type;
     Reactions = new List <Reaction>();
 }
예제 #11
0
 public void AffectTo(WeatherType weather)
 {
     if (weather == WeatherType.Cold)
     {
         health *= 0.98;
     }
 }
예제 #12
0
        public static WeatherObject TryToGetWeather(this WeatherType type, int time, double temperature, ref string currentFootprint)
        {
            if (type == WeatherType.None)
            {
                return(null);
            }

            try {
                var candidates = WeatherManager.Instance.Loaded.Where(x => x.Fits(time, temperature)).ToList();
                var closest    = type.FindClosestWeather(from w in candidates select w.Type);
                if (closest == null)
                {
                    return(time < CommonAcConsts.TimeMinimum || time > CommonAcConsts.TimeMaximum
                            ? candidates.RandomElementOrDefault()
                            : null);
                }

                candidates = candidates.Where(x => x.Type == closest).ToList();
                var footprint = candidates.Select(x => x.Id).JoinToString(';');
                if (footprint == currentFootprint)
                {
                    return(null);
                }

                currentFootprint = footprint;
                return(candidates.RandomElementOrDefault());
            } catch (Exception e) {
                NonfatalError.NotifyBackground("Can’t find weather", e);
                return(null);
            }
        }
        public void GivenTheWeatherIs(WeatherType weather)
        {
            dressed = new List <string>();
            Console.WriteLine(dressed.ToArray());
            switch (weather)
            {
            case WeatherType.HOT:
                _rulesEngine.ClearRules();
                _hotWeatherRules = new HotWeatherRules(_rulesEngine);
                _hotWeatherRules.ConfigureRules();
                _weatherType = new HotWeatherDressing(_writerMock, _dressValidator);
                break;

            case WeatherType.COLD:
                _rulesEngine.ClearRules();
                _coldWeatherRules = new ColdWeatherRules(_rulesEngine);
                _coldWeatherRules.ConfigureRules();
                _weatherType = new ColdWeatherDressing(_writerMock, _dressValidator);
                break;

            default:
                _weatherType = null;
                break;
            }

            ScenarioContext.Current.Add("WeatherType", _weatherType);
        }
예제 #14
0
    public void ChangeWeather()
    {
        currentWeatherTime = 0.0f;
        int weatherChosen = UnityEngine.Random.Range(0, 100);

        previousWeather = currentWeather;

        if (weatherChosen >= 0.0f && weatherChosen <= RainPercentage)
        {
            currentWeather = WeatherType.Rain;
        }
        else if (weatherChosen >= RainPercentage + 1 && weatherChosen <= RainPercentage + SnowPercentage)
        {
            currentWeather = WeatherType.Snow;
        }
        else if (weatherChosen >= RainPercentage + SnowPercentage + 1 && weatherChosen <= RainPercentage + SnowPercentage + CloudPercentage)
        {
            currentWeather = WeatherType.Cloud;
        }
        else if (weatherChosen >= RainPercentage + SnowPercentage + CloudPercentage + 1 && weatherChosen <= 100)
        {
            currentWeather = WeatherType.Sun;
        }

        ChangeWeatherEffect();
        StartCoroutine("WeatherSwap");
        ChangeEffectedObjects();
    }
예제 #15
0
        public static bool IsWeatherBoosted(this PokedexPokemon pkmn, WeatherType weather)
        {
            var types     = pkmn?.Types;
            var isBoosted = types?.Exists(x => Strings.WeatherBoosts[weather].Contains(x)) ?? false;

            return(isBoosted);
        }
예제 #16
0
            //functions
            public void Start()
            {
                CapturedBy     = 0;
                CameraPosition = MapPosition;

                for (int i = 0; i < PointList.Count; i++)
                {
                    PointList[i].Start();
                }

                if (GlobalRandom.Next(0, 100) <= 20)
                {
                    WeatherType weather = GlobalGame.GetWeatherType();
                    if (weather == WeatherType.None)
                    {
                        GlobalGame.SetWeatherType(WeatherType.Rain);
                        return;
                    }
                    if (weather == WeatherType.Rain)
                    {
                        GlobalGame.SetWeatherType(WeatherType.Snow);
                        return;
                    }
                    if (weather == WeatherType.Snow)
                    {
                        GlobalGame.SetWeatherType(WeatherType.None);
                        return;
                    }
                }
            }
예제 #17
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log(weatherSys.Hour);
        currentWeather = CurrentWeather();
        ChangeWeather(currentWeather);
        // Debug.Log(weatherSys.monthCounter);
        //Debug.Log("Spring " + weatherSys.isSpring);
        //Debug.Log("Summer " + weatherSys.isSummer);
        //Debug.Log("Fall " + weatherSys.isFall);
        //Debug.Log("Winter " + weatherSys.isWinter);

        if (weatherSys.dayCounter >= 3)
        {
            weatherSys.dayCounter = 0;
            weatherSys.monthCounter++;
            if (weatherSys.monthCounter > 12)
            {
                weatherSys.monthCounter = 1;
            }
        }

        if (weatherSys.weatherForecaster == 12)
        {
            // rain.gameObject.SetActive(true);
        }
    }
        public int LogWeatherEvent(DateTime datetime, WeatherType type, bool happy,
                                   string name, string quote)
        {
            //This controller method demonstrates that DbSet Add behaves the same
            //as EF6: affecting every item in a [disconnected] graph with the same state
            //As well as Attach, Remove and the new Update.

            WeatherEvent wE;

            if (String.IsNullOrEmpty(name))
            {
                wE = WeatherEvent.Create(datetime, type, happy);
            }
            else
            {
                wE = WeatherEvent.Create(datetime, type, happy,
                                         new List <string[]> {
                    new[] { name, quote }
                });
            }
            _context.WeatherEvents.Add(wE);
            var affectedRowCount = _context.SaveChanges();

            return(affectedRowCount);
        }
예제 #19
0
        private static IMessage CreateMessage(WeatherType weatherType)
        {
            switch (weatherType)
            {
            case WeatherType.SessionClock:
                return(new WeatherSessionClock());

            case WeatherType.TrackTemperature:
                return(new WeatherTrackTemperature());

            case WeatherType.AirTemperature:
                return(new WeatherAirTemperature());

            case WeatherType.WetTrack:
                return(new WeatherWetTrack());

            case WeatherType.WindSpeed:
                return(new WeatherWindSpeed());

            case WeatherType.Humidity:
                return(new WeatherHumidity());

            case WeatherType.Pressure:
                return(new WeatherPressure());

            case WeatherType.WindDirection:
                return(new WeatherWindDirection());

            default:
                return(new Weather());
            }
        }
예제 #20
0
        public void SetWeather(WeatherType next)
        {
            Debug.Log("Next weather change: " + next);
            ClearAllWeather();
            switch (next)
            {
            case WeatherType.Cloudy:
                // TODO make skybox cloudy
                SetFog(true, SunnyFogDensity);
                break;

            case WeatherType.Overcast:
                SetRainOvercast();
                break;

            case WeatherType.Fog:
                SetRainOvercast();
                SetFog(true, HeavyFogDensity);
                break;

            case WeatherType.Rain:
                StartRaining();
                break;

            case WeatherType.Thunder:
                StartStorming();
                break;

            case WeatherType.Snow:
                StartSnowing();
                break;
            }
            RaiseOnWeatherChangeEvent(next);
            PlayerWeather.WeatherType = next;
        }
예제 #21
0
        public MeteorologicalConditions GetConditionsForDay(int day)
        {
            var meteorologicalConditions = new MeteorologicalConditions {
                Planets = Planets
            };
            var planetPositions = Planets.ToDictionary(p => p.Name, p => GetPlanetPosition(p, day));

            meteorologicalConditions.PlanetPositions = planetPositions;
            Triangle triangle = new Triangle(
                planetPositions[Planets[0].Name],
                planetPositions[Planets[1].Name],
                planetPositions[Planets[2].Name]
                );
            var triangleArea = triangle.GetArea();

            // Is a Line
            if (triangleArea <= Constants.MaxDecimalTolerance)
            {
                WeatherType weather = LineTouchOrigin(triangle.PointA, triangle.PointB) ? WeatherType.Drought : WeatherType.Nice;
                meteorologicalConditions.Weather = weather.GetDescription();
            }
            // Is a triangle
            else
            {
                WeatherType weather = triangle.ContainsPoint(new Point {
                    X = 0, Y = 0
                }) ? WeatherType.Rainy : WeatherType.Normal;
                meteorologicalConditions.TrianglePerimeter = triangle.GetPerimeter();
                meteorologicalConditions.Weather           = weather.GetDescription();
            }
            return(meteorologicalConditions);
        }
예제 #22
0
    IEnumerator FadeInRoutine(WeatherType type)
    {
        switch (type)
        {
        case WeatherType.SUNNY:
            forestSound.Play();
            while (forestSound.volume < maxVolume)
            {
                forestSound.volume += increment;
                yield return(new WaitForSeconds(delay));
            }
            break;

        case WeatherType.RAINING:
            rainSound.Play();
            while (rainSound.volume < maxVolume)
            {
                rainSound.volume += increment;
                yield return(new WaitForSeconds(delay));
            }
            break;

        case WeatherType.THUNDERSTORM:
            stormSound.Play();
            while (stormSound.volume < maxVolume)
            {
                stormSound.volume += increment;
                yield return(new WaitForSeconds(delay));
            }
            break;
        }
    }
예제 #23
0
        private IEnumerator TestWeathers()
        {
            const int    waitSeconds = 6;
            const string spacer      = "################################################";

            var         weatherManager = GameManager.Instance.WeatherManager;
            WeatherType currentWeather = Weather;
            var         stringBuilder  = new StringBuilder();

            stringBuilder.AppendLine(spacer);

            foreach (var weather in Enum.GetValues(typeof(WeatherType)).Cast <WeatherType>().Distinct())
            {
                weatherManager.SetWeather(weather);
                DaggerfallUI.Instance.PopupMessage(weather.ToString());

                stringBuilder.AppendLine(weather.ToString().ToUpperInvariant());
                stringBuilder.AppendLine(string.Format("Terrain: {0}", TerrainWindStrength));
                stringBuilder.AppendLine(string.Format("Ambient: {0}", AmbientWindStrength));

                yield return(new WaitForSeconds(waitSeconds));
            }

            weatherManager.SetWeather(currentWeather);
            stringBuilder.Append(spacer);
            Debug.Log(stringBuilder);
            DaggerfallUI.Instance.PopupMessage("Test ended");
        }
예제 #24
0
    IEnumerator FadeOutRoutine(WeatherType type)
    {
        switch (type)
        {
        case WeatherType.SUNNY:
            while (forestSound.volume > 0)
            {
                forestSound.volume -= increment;
                yield return(new WaitForSeconds(delay));
            }
            forestSound.Stop();
            break;

        case WeatherType.RAINING:
            while (rainSound.volume > 0)
            {
                rainSound.volume -= increment;
                yield return(new WaitForSeconds(delay));
            }
            rainSound.Stop();
            break;

        case WeatherType.THUNDERSTORM:
            while (stormSound.volume > 0)
            {
                stormSound.volume -= increment;
                yield return(new WaitForSeconds(delay));
            }
            stormSound.Stop();
            break;
        }
    }
예제 #25
0
        public static DiscordColor BuildWeatherColor(this WeatherType weather)
        {
            switch (weather)
            {
            case WeatherType.Clear:
                return(DiscordColor.Yellow);

            case WeatherType.Cloudy:
                return(DiscordColor.Grayple);

            case WeatherType.Fog:
                return(DiscordColor.DarkGray);

            case WeatherType.PartlyCloudy:
                return(DiscordColor.LightGray);

            case WeatherType.Rain:
                return(DiscordColor.Blue);

            case WeatherType.Snow:
                return(DiscordColor.White);

            case WeatherType.Windy:
                return(DiscordColor.Purple);

            case WeatherType.None:
            default:
                return(DiscordColor.Gray);
            }
        }
예제 #26
0
        public Dictionary <string, double> ShortestPath(Vehicle vehicle,
                                                        WeatherType weatherType,
                                                        List <WeatherImpact> weatherImpactList,
                                                        List <List <Orbit> > possiblePaths)
        {
            if (!vehicle.SupportedWeather.Contains(weatherType))
            {
                return(null);
            }

            WeatherImpact wi = weatherImpactList.FirstOrDefault(a => a.Weather == weatherType);

            Dictionary <string, double> result = new Dictionary <string, double>();

            foreach (List <Orbit> orbits in possiblePaths)
            {
                double time = 0.0;
                string path = "";
                foreach (Orbit orbit in orbits)
                {
                    time += TimeToCrossTheOrbit(vehicle, wi, orbit, weatherType).Value;
                    path  = path + "->" + orbit.Name;
                }
                result.Add(path, time);
            }

            double min = result.Min(a => a.Value);
            string key = result.FirstOrDefault(a => a.Value == min).Key;

            var res = new Dictionary <string, double>();

            res.Add(key, min);

            return(res);
        }
예제 #27
0
        public void SetWeather(WeatherZone weatherZone, WeatherType type, float intensity)
        {
            weatherZone.CurrentWeather = type;
            weatherZone.Intensity      = intensity;

            this.SendWeather(weatherZone);
        }
예제 #28
0
        public void GetWeatherConfig(WeatherType type, out string configName, out int sceneId)
        {
            configName = this._config.defaultConfigName;
            sceneId    = this._config.defaultSceneId;
            int index  = 0;
            int length = this._config.weatherMatch.Length;

            while (index < length)
            {
                if (this._config.weatherMatch[index].realTimeWeatherType == type)
                {
                    float num3 = UnityEngine.Random.value;
                    int   num4 = 0;
                    int   num5 = this._config.weatherMatch[index].weatherPatterns.Length;
                    while (num4 < num5)
                    {
                        float num6 = num3 * num5;
                        float num7 = num4 + 1;
                        if (num6 < num7)
                        {
                            configName = this._config.weatherMatch[index].weatherPatterns[num4].configName;
                            sceneId    = this._config.weatherMatch[index].weatherPatterns[num4].sceneId;
                            break;
                        }
                        num4++;
                    }
                    break;
                }
                index++;
            }
        }
예제 #29
0
    private void SetWeather(WeatherType weather)
    {
        this.CurWeather = weather;
        switch (weather)
        {
        case WeatherType.Default:
            Debug.Log("默认天气");
            break;

        case WeatherType.Wind:
            Debug.Log("天气:风");
            break;

        case WeatherType.Lightning:
            Debug.Log("天气:雷电");
            break;

        case WeatherType.Sandstorm:
            Debug.Log("天气:沙暴");
            break;

        case WeatherType.Haze:
            Debug.Log("天气:雾霾");
            break;

        default:
            Debug.Log("未知天气");
            break;
        }
    }
예제 #30
0
파일: WeatherSystem.cs 프로젝트: Pircs/Yi
        public static void Start()
        {
            YiScheduler.Instance.Do(TimeSpan.FromMinutes(60), Start);
            try
            {
                var json = WebClient.DownloadString(QueryString);
                _currentWeather = JsonConvert.DeserializeObject <WeatherJson>(json);

                switch (_currentWeather.weather.First().main)
                {
                case "Rain":
                    CurrentWeatherType = WeatherType.Rain;
                    SetRaining(150, (int)_currentWeather.wind.deg);
                    break;

                case "Snow":
                    CurrentWeatherType = WeatherType.Snow;
                    SetSnowing(150, (int)_currentWeather.wind.deg);
                    break;

                default:
                {
                    SetClear(150, (int)_currentWeather.wind.deg);
                    Output.WriteLine("Default Weather: " + _currentWeather.weather.First().main);
                    break;
                }
                }
            }
            catch (Exception e)
            {
                Output.WriteLine(e);
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Description")] WeatherType weatherType)
        {
            if (id != weatherType.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(weatherType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WeatherTypeExists(weatherType.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(weatherType));
        }
 private WeatherEvent(DateTime dateTime, WeatherType type, Boolean hooray)
 {
     this.Date = dateTime.Date;
     this.Time = dateTime.TimeOfDay;
     Hooray = hooray;
     Type = type;
     Reactions = new List<Reaction>();
     ObjectState=ObjectState.Added;
 }
예제 #33
0
        public void Deserialise(Header header, Packet payload)
        {
            ShortPacket sp = (ShortPacket)payload;

            DetailedType = (WeatherType)sp.ShortDatum;
            BaseData = (sp.Data == null) ? String.Empty : StringUtils.ASCIIBytesToString(sp.Data);

            OnDeserialiseComplete();
        }
 public static WeatherEvent Create(DateTime date, WeatherType type, Boolean hooray, List<string[]> reactions)
 {
     var wE = new WeatherEvent(date, type, hooray);
     foreach (var reaction in reactions)
     {
         wE.Reactions.Add(new Reaction { Name = reaction[0], Quote = reaction[1] });
         Console.WriteLine($"Reactions Count {wE.Reactions.Count}");
     }
     return wE;
 }
예제 #35
0
 public WeatherInfo GetWeather(WeatherType dummyType = WeatherType.SUNNY)
 {
     if (this.isOnline)
     {
         return Oniyamma.OniyammaService.Current.GetWeather(dummyType);
     }
     var weatherInfo = new WeatherInfo();
     weatherInfo.Type = dummyType;
     return weatherInfo;
 }
예제 #36
0
        public void SetWeather(WorldSession session, WeatherType type, float intensity)
        {
            var weatherZone = GetWeatherZoneForSession(session);

            if (weatherZone == null)
            {
                Log.Print(LogType.Error, session.Player.Name + " attempted to change weather of a mapID that was not setup.");
                return;
            }

            SetWeather(weatherZone, type, intensity);
        }
예제 #37
0
        public static IList<string> Weather(int year, IEnumerable<int> stations, IDictionary<DateTime, IDictionary<int, float>> data, WeatherType type)
        {
            var res = new List<string>();

            var startOfYear = new DateTime(year, 1, 1);

            res.Add(weather[type]);
            res.Add(string.Format("{0} {1}", stations.Count(), startOfYear.AddYears(1).AddDays(-1).DayOfYear));
            res.Add(writeStations(stations));
            res.Add("");
            res.Add("");
            res.Add("");

            var emptyDict = new Dictionary<int, float>();

            for (DateTime date = startOfYear; date.Year == year; date = date.AddDays(1))
                res.Add(writeString(date, stations, data.ContainsKey(date) ? data[date] : emptyDict));
            return res;
        }
 public int LogWeatherEvent(DateTime datetime, WeatherType type, bool happy,
                                 string name, string quote)
 {
     
     //This controller method demonstrates that DbSet Add behaves the same
     //as EF6: affecting every item in a [disconnected] graph with the same state
     //As well as Attach, Remove and the new Update.
     
     WeatherEvent wE;
     if (String.IsNullOrEmpty(name))
     {
         wE = WeatherEvent.Create(datetime, type, happy);
     }
     else
     {
         wE = WeatherEvent.Create(datetime, type, happy,
                                  new List<string[]> { new[] { name, quote } });
     }
      _context.WeatherEvents.Add(wE);
     var affectedRowCount = _context.SaveChanges();
     return affectedRowCount;
 }
예제 #39
0
    /// <summary>
    /// 更換環境音效
    /// </summary>
    /// <param name="state">天氣類型</param>
    public void ChangeEnvironmentSFX(WeatherType state)
    {
        if (GlobalPlayer)
        {
            if (!GlobalPlayer.isPlaying)
                GlobalPlayer.Play();

            switch (state)
            {
                case WeatherType.Sunny:
                    GlobalPlayer.clip = SunnySFX;
                    break;
                case WeatherType.Cloudy:
                    GlobalPlayer.clip = CloudySFX;
                    break;
                case WeatherType.Rain:
                    GlobalPlayer.clip = RainySFX;
                    break;
            }
        }
    }
예제 #40
0
    /// <summary> 設定天氣背景 </summary>
    /// <param name='visable'> 天氣類別 </param>
    public void setWeatherBackground(WeatherType weatherType)
    {
        // 消失切換
        switch(weatherType)
        {
        case WeatherType.Sunny:
        {
            TweenAlpha.Begin(sunnyBackgroundObj,2,1);
            TweenAlpha.Begin(cloudyBackgroundObj,2,0);
            TweenAlpha.Begin(rainyBackgroundObj,2,0);
            break;
        }
        case WeatherType.Cloudy:
        {
            TweenAlpha.Begin(sunnyBackgroundObj,2,0);
            TweenAlpha.Begin(cloudyBackgroundObj,2,1);
            TweenAlpha.Begin(rainyBackgroundObj,2,0);
            break;
        }
        case WeatherType.Rain:
        {
            TweenAlpha.Begin(sunnyBackgroundObj,2,0);
            TweenAlpha.Begin(cloudyBackgroundObj,2,0);
            TweenAlpha.Begin(rainyBackgroundObj,2,1);
            break;
        }
        }

        //切換按鈕
        //InitControlsColor(lavaPosData,weatherType);
    }
예제 #41
0
    /// <summary>
    /// 控制器初始化
    /// </summary>
    private void InitControlsColor(int[] lavaPosData,WeatherType weatherType)
    {
        for(int tag = 0; tag< Sct_DEFCONST.LAVA_AMOUNT_MAX;tag++)
        {
            if(lavaPosData[tag] > 0)
            {
                btn_Control[tag].transform.Find("Background").GetComponent<UISprite>().spriteName 	= "Png_Ingame_Controller_Ball"	+ "0" + lavaPosData[tag];

                if(weatherType != WeatherType.Rain)
                {
                    btn_Bouns[tag].transform.Find("Background").GetComponent<UISprite>().spriteName 	= "Png_Ingame_Controller_CircleIn"+ "0" + lavaPosData[tag];
                }
                else
                {

                    btn_Bouns[tag].transform.Find("Background").GetComponent<UISprite>().spriteName 	= "Png_Ingame_Controller_ProtectionN0" + lavaPosData[tag];
                }

                sprite_CircleBg[tag].spriteName = "Png_Ingame_Controller_Circle"+ "0" + lavaPosData[tag];
            }
            else
            {
                btn_Control[tag].transform.Find("Background").GetComponent<UISprite>().enabled = false;
                btn_Bouns[tag].transform.Find("Background").GetComponent<UISprite>().enabled = false;
                sprite_CircleBg[tag].alpha = 0.0f;
                btn_Catcher[tag].SetActive(false);
                btn_Poison[tag].SetActive(false);
            }
        }
    }
예제 #42
0
 private void RequestServiceCommand(AppMirrorAction.AppActionTypes actionType, Oniyamma.LogType? logType, AppMirrorAction action)
 {
     switch (actionType)
     {
         case AppMirrorAction.AppActionTypes.GreetingLogging:
             {
                 this.StartCoroutine(this.TakePhoto(
                    delegate (string fileName)
                    {
                        Debug.Log(string.Format("Command:{0}  ScreenShot:{1} {2}", logType, fileName, File.Exists(fileName)));
                        this.Service.AddLog(new LogParameter()
                        {
                            Type = logType,
                            FilePath = fileName,
                            UserId = action.UserName,
                        });
                    })
                    );
                 this.AddAction(new AppMirrorAction(MirrorAction<AppMirrorAction.AppActionTypes>.ActionTypes.SystemFeedback, serviceUiFeedbackMap[(Oniyamma.LogType)logType]));
             }
             break;
         case AppMirrorAction.AppActionTypes.EmotionLoging:
             {
                 Debug.Log(string.Format("Command:{0}  SMILE:{1}", "Emotion", action.FaceExpressions.Smile));
                 this.Service.ApplyEmotion(new EmotionParameter()
                 {
                     Kiss = action.FaceExpressions.Kiss,
                     Smile = action.FaceExpressions.Smile,
                     MouthOpen = action.FaceExpressions.MouthOpen,
                     EyesUp = action.FaceExpressions.EyesUp,
                     EyesDown = action.FaceExpressions.EyesDown,
                     EyesClosedLeft = action.FaceExpressions.EyesClosedLeft,
                     EyesClosedRight = action.FaceExpressions.EyesClosedRight,
                 });
             }
             break;
         case AppMirrorAction.AppActionTypes.WeatherQuery:
             {
                 var weathers = new WeatherType[4]
                 {
                     WeatherType.SUNNY,
                     WeatherType.CLOUDY,
                     WeatherType.RAINY,
                     WeatherType.SNOW,
                 };
                 var weather = this.Service.GetWeather(weathers[UnityEngine.Random.Range(0, 4)]);
                 Debug.Log(weather.Type);
                 this.currentWeather = weather.Type;
             }
             this.AddAction(new AppMirrorAction(MirrorAction<AppMirrorAction.AppActionTypes>.ActionTypes.SystemFeedback, AppMirrorAction.AppActionTypes.WeatherQueryFeedback));
             break;
     }
 }
    void Awake()
    {
        weatherIntensity = 1;
        currentWeather = WeatherType.Sun;
        WeatherForecast = new Queue<WeatherType>();

        WeatherForecastIcon newIcon;

        //First day is nice
        newIcon = Instantiate(WeatherForecastIconPrefab, transform.position, transform.rotation) as WeatherForecastIcon;
        newIcon.transform.parent = transform.parent;
        newIcon.lifeTime = WorldTime.dayDuration * 3;
        newIcon.SetSprite(SunnySprite);

        //Second day is rainy
        WeatherForecast.Enqueue(WeatherType.Rain);
        newIcon = Instantiate(WeatherForecastIconPrefab, transform.position, transform.rotation) as WeatherForecastIcon;
        newIcon.transform.parent = transform.parent;
        newIcon.lifeTime = WorldTime.dayDuration * 2;
        newIcon.SetSprite(RainySprite);

        //Third day is nice
        WeatherForecast.Enqueue(WeatherType.Sun);
        newIcon = Instantiate(WeatherForecastIconPrefab, transform.position, transform.rotation) as WeatherForecastIcon;
        newIcon.transform.parent = transform.parent;
        newIcon.lifeTime = WorldTime.dayDuration * 1;
        newIcon.SetSprite(SunnySprite);

        //Fourth day is snowy
        WeatherForecast.Enqueue(WeatherType.Snow);
        newIcon = Instantiate(WeatherForecastIconPrefab, transform.position, transform.rotation) as WeatherForecastIcon;
        newIcon.transform.parent = transform.parent;
        newIcon.lifeTime = 0;
        newIcon.SetSprite(SnowySprite);
    }
    public void ChangeWeather()
    {
        WeatherType nextWeather = GetNextWeather();
        WeatherForecast.Enqueue(nextWeather);
        currentWeather = WeatherForecast.Dequeue();

        weatherIntensity = GetNewWeatherIntensity();

        WeatherForecastIcon newIcon = Instantiate(WeatherForecastIconPrefab, transform.position, transform.rotation) as WeatherForecastIcon;
        newIcon.transform.parent = transform.parent;

        Sprite newSprite = SunnySprite;

        switch (nextWeather)
        {
            case WeatherType.Sun:
                newSprite = SunnySprite;
                break;
            case WeatherType.Rain:
                newSprite = RainySprite;
                break;
            case WeatherType.Snow:
                newSprite = SnowySprite;
                break;
            case WeatherType.Volcano:
                newSprite = VolcanoSprite;
                break;
        }
        newIcon.SetSprite(newSprite);

        rainParticleSystem.SetActive(false);
        snowParticleSystem.SetActive(false);

        switch (currentWeather)
        {
            case WeatherType.Sun:
                sunnySystem.SetActive(true);
                if(timer.isDay())
                    targetCol = sunnyCol_day;
                else
                    targetCol = sunnyCol_night;
                break;
            case WeatherType.Rain:
                rainParticleSystem.SetActive(true);
                if(timer.isDay())
                    targetCol = rainCol_day;
                else
                    targetCol = rainCol_night;
                break;
            case WeatherType.Snow:
                snowParticleSystem.SetActive(true);
                if(timer.isDay())
                    targetCol = snowCol_day;
                else
                    targetCol = snowCol_night;
                break;
            case WeatherType.Volcano:
                if(timer.isDay())
                    targetCol = doomCol_day;
                else
                    targetCol = doomCol_night;
                break;
        }
    }
    public static IEnumerable<WeatherForecast> Type(this IEnumerable<WeatherForecast> forecasts, WeatherType type)
    {
      Assertion.NotNull(forecasts);

      return forecasts.Where(it => it != null && it.Type == type);
    }
 public static WeatherEvent Create(DateTime date, WeatherType type, Boolean hooray)
 {
     return new WeatherEvent(date, type, hooray);
 }
		/// <summary>
		/// Get weather info
		/// </summary>
		public WeatherInfo GetWeather(WeatherType dummyType = WeatherType.SUNNY)
		{
			var request = new RestRequest("/api/v1/get_weather", Method.GET);
			// var response = client.Execute(request);
			// TODO: Call Api
			// Return dummy info
			Random rnd = new Random();
			return new WeatherInfo()
			{
				Temperature = (float)Math.Round(rnd.Next(1, 20) + rnd.NextDouble(), 1),
				Type = dummyType
			};
		}
예제 #48
0
    private void ParseXML(XmlDocument d)
    {
        List<float> result = new List<float>();
        XmlNode currentWeatherNode = d["current"];

        foreach (XmlElement currentChild in currentWeatherNode.ChildNodes)
        {
            if (currentChild.LocalName == "city")
            {
                XmlNode cityNode = currentChild as XmlNode;
                city = currentChild.GetAttribute("name");
                foreach (XmlElement cityChild in cityNode.ChildNodes)
                {
                    if (cityChild.LocalName == "coord")
                    {
                        //Do nothing, we already have the lat lon
                    }
                    if (cityChild.LocalName == "country")
                    {
                        //Do nothing, we already have the lat lon
                        country = cityChild.InnerText;
                    }
                }

            }
            if (currentChild.LocalName == "temperature")
            {
                temperature = float.Parse(currentChild.GetAttribute("value"));
            }
            if (currentChild.LocalName == "humidity")
            {
                humidity = float.Parse(currentChild.GetAttribute("value"));
            }
            if (currentChild.LocalName == "pressure")
            {
                pressure = float.Parse(currentChild.GetAttribute("value"));
            }

            if (currentChild.LocalName == "wind")
            {
                XmlNode windNode = currentChild as XmlNode;
                foreach (XmlElement windChild in windNode.ChildNodes)
                {
                    if (windChild.LocalName == "speed")
                    {
                        windSpeed = float.Parse(windChild.GetAttribute("value"));
                        //Do nothing, we already have the lat lon
                    }
                    if (windChild.LocalName == "direction")
                    {
                        //Do nothing, we already have the lat lon
                        windDirection = float.Parse(windChild.GetAttribute("value"));
                    }
                }
            }
            if (currentChild.LocalName == "clouds")
            {
                cloudIntensity = float.Parse(currentChild.GetAttribute("value"));
            }
            if (currentChild.LocalName == "precipitation")
            {
                string value = currentChild.GetAttribute("mode");
                if(value.Contains("no"))
                    precipitation = false;
                else
                    precipitation = true;
            }
            if (currentChild.LocalName == "weather")
            {
                int weatherCode = int.Parse(currentChild.GetAttribute("number"));
                int mainWeather = weatherCode/100;
                if (mainWeather == 200)
                    weather = WeatherType.Thunder;
                else if (mainWeather == 3)
                    weather = WeatherType.Rain;
                else if (mainWeather == 5)
                    weather = WeatherType.Rain;
                else if (mainWeather == 6)
                    weather = WeatherType.Snow;
                else if (mainWeather == 7)
                    weather = WeatherType.Fog;
                else if (mainWeather == 8)
                    weather = WeatherType.Clouds;
                else weather = WeatherType.Clear;
            }
            if (currentChild.LocalName == "lastupdate")
            {
                lastUpdate = currentChild.GetAttribute("value");
            }
        }
    }
예제 #49
0
 private static string meteoDir(DataType type, DateTime date, WeatherType weather)
 {
     return dataDir + "\\Meteo\\" + mapping[type] + "\\" + date.ToString("yyyMMdd") +
         "\\" + string.Format(weatherMapping[weather], date.ToString("yy"));
 }
예제 #50
0
        private static IMessage CreateMessage(WeatherType weatherType)
        {
            switch (weatherType)
            {
                case WeatherType.SessionClock:
                    return new WeatherSessionClock();

                case WeatherType.TrackTemperature:
                    return new WeatherTrackTemperature();

                case WeatherType.AirTemperature:
                    return new WeatherAirTemperature();

                case WeatherType.WetTrack:
                    return new WeatherWetTrack();

                case WeatherType.WindSpeed:
                    return new WeatherWindSpeed();

                case WeatherType.Humidity:
                    return new WeatherHumidity();

                case WeatherType.Pressure:
                    return new WeatherPressure();

                case WeatherType.WindDirection:
                    return new WeatherWindDirection();

                default:
                    return new Weather();
            }
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            WeatherType = (WeatherType) reader.ReadByte();

            return this;
        }
예제 #52
0
    /// <summary>
    /// 相乘後轉換天氣
    /// </summary>
    /// <param name="changeNum"></param>
    /// <param name="lavaNum"></param>
    /// <returns></returns>
    private void changeWeather(List<int> changeNum)
    {
        int checkNum = 1;

        for (int i = 0; i < genLavas.LavaPlayers.Count; ++i)
        {
            checkNum *= changeNum[i];
        }

        if (checkNum == 0)
            gameweather = WeatherType.Rain;
        else if (checkNum == 1)
            gameweather = WeatherType.Sunny;
        else if (checkNum > 1)
            gameweather = WeatherType.Cloudy;
    }
예제 #53
0
파일: Packet.cs 프로젝트: fragmer/fCraft
 public static Packet MakeEnvSetWeatherType(WeatherType weather) {
     Packet packet = new Packet(OpCode.EnvSetWeatherType);
     packet.Bytes[1] = (byte)weather;
     return packet;
 }
예제 #54
0
 public void ShowWeather(WeatherType type)
 {
     if (this.HasWeatherSkill )
     {
         Debug.Log(this.ActorLogicData.Name + ": " + type.ToString());
         if (this.ShowWeatherEvent != null)
         {
             this.ShowWeatherEvent(type);
         }
     }
 }