public object Convert(object value, Type targetType, object parameter, string language) { bool isDay = Astro.Sun.IsShinning(); WeatherState state = WeatherState.Unknown; if (value is Weather) { var weather = value as Weather; state = weather.GetState(); switch (weather.Type) { case WeatherType.ForecastHour: isDay = Astro.Sun.IsShinning(weather.MessureTime); break; case WeatherType.ForecaseDaily: isDay = true; break; } } else if (value is WeatherState) { state = (WeatherState)value; } return(new BitmapImage(new Uri($"ms-appx://MagicMirror/Assets/Weather/{GetIcon(state, isDay)}.png"))); }
public static WeatherState OnLoadForecast(WeatherState state) { return(state with { Loading = true }); }
public static WeatherState OnSetInitialized(WeatherState state) { return(state with { Initialized = true }); }
public ForecastModel(DateTime date, double tempeture, WeatherState state, WeatherUnit unit) { this.Date = date; this.Tempeture = tempeture; this.WeatherState = state; this.Unit = unit; }
public void Update(float fElapsed) { WeatherState _oldState = _state; if (Game.Mouse.IsRightButtonReleased()) { _state = _state == WeatherState.CLOUD ? WeatherState.SUN : WeatherState.CLOUD; } _cloud.loadUp(fElapsed); _sun.loadUp(fElapsed); if (_oldState != _state) { if (_state == WeatherState.CLOUD) { _sun.Disable(); _cloud.Enable(); } else { _cloud.Disable(); _sun.Enable(); } } if (_state == WeatherState.CLOUD || !_cloud.isFinishedWithWork) { _cloud.Update(fElapsed); } if ((_state == WeatherState.SUN || !_sun.isFinishedWithWork)) { _sun.Update(fElapsed); } }
void ChangeBackgroundWeather(WeatherState weather) { Debug.Log ("ChangeBackground:" + weather); switch (weather) { case WeatherState.Sunny: this.myImage.sprite = Sunny; break; case WeatherState.Rain: this.myImage.sprite = Rainy; break; case WeatherState.Storm: this.myImage.sprite = Stormy; break; case WeatherState.Thunder: this.myImage.sprite = Thunder; break; case WeatherState.Snow: this.myImage.sprite = Snowy; break; } }
private void Update() { //checked the randomise function //Debug.Log(GetRandomNumber(0, 100)); if (curState != weatherState) { switch (weatherState) { case WeatherState.clear: clearSky(); break; case WeatherState.cloudy: break; case WeatherState.storm: cloudMaterial.color = Color.grey; break; default: break; } curState = weatherState; } }
void Start() { currentState = SunnyState; WeatherDisplay = GameObject.FindGameObjectWithTag("WeatherDisplay"); emissionModule = rain.emission; StartCoroutine(WeatherPickRepeater(repeaterTime)); }
void LevelWeather() { if (OldWeather != gameLevelInfo.Weather) { OldWeather = this.gameLevelInfo.Weather; WeatherManager.Instance.ChangeWeather (gameLevelInfo.Weather); } }
//天気の変更 void Weather_ChangeBase() { float weatherX = Input.GetAxis("Horizontal"); float weatherY = Input.GetAxis("Vertical"); if (weatherX > 0.1f) { this.WS = WeatherState.Rainy; } if (weatherX < -0.1f) { this.WS = WeatherState.Sunny; } if (weatherY > 0.1f) { this.WS = WeatherState.Snowy; } if (weatherY < -0.1f) { this.WS = WeatherState.Cloudy; } }
public WeatherData(double currentTempeture, WeatherState currentState, DateTime currentDate, string locationName) { this.CurrentTempeture = currentTempeture; this.CurrentState = currentState; this.CurrentDate = currentDate; this.LocationName = locationName; }
protected void UpdateWeather(WeatherSystem weatherSystem) { switch (state) { case WeatherState.STARTING: OnStarting(weatherSystem, (Time.time - _startTime) / _enterCrossTime); if (Time.time - _startTime >= _enterCrossTime) { _state = WeatherState.RUNNING; } break; case WeatherState.RUNNING: OnRunning(weatherSystem); break; case WeatherState.STOPPING: var factor = Mathf.Clamp((Time.time - _stopTime) / _exitCrossTime, 0, 1); if (_audioSource != null) { _audioSource.volume = 1 - factor; } OnStoping(weatherSystem, factor); break; } }
//天気の強弱の変更 void Weather_ChangeStrength() { if (Input.GetKeyDown(KeyCode.X)) { switch (this.WS) { case WeatherState.Sunny: this.WS = WeatherState.Sunny_Hard; break; case WeatherState.Sunny_Hard: this.WS = WeatherState.Sunny; break; case WeatherState.Rainy: this.WS = WeatherState.Rainy_Hard; break; case WeatherState.Rainy_Hard: this.WS = WeatherState.Rainy; break; case WeatherState.Snowy: this.WS = WeatherState.Snowy_Hard; break; case WeatherState.Snowy_Hard: this.WS = WeatherState.Snowy; break; } } }
public static WeatherState OnSetForecasts(WeatherState state, WeatherSetForecastAction action) { return(state with { Forecasts = action.Forecasts, Loading = false }); }
public WeatherDwarfModel(int currentTempeture, WeatherState currentState, DateTime currentDate, List <ForecastModel> forecasts, string locationName) { CurrentTempeture = currentTempeture; CurrentState = currentState; CurrentDate = currentDate; Forecasts = forecasts; LocationName = locationName; }
public WeatherData(double currentTempeture, WeatherState currentState, DateTime currentDate, string locationName, List <WeatherData> forcast) { this.CurrentTempeture = currentTempeture; this.CurrentState = currentState; this.CurrentDate = currentDate; this.LocationName = locationName; this.Forecast = forcast; }
public ContinuousMarkovProcessGenerator(double[][] transitionRateMatrix, WeatherState weatherState) { _baseRng = new Random(); _discreteRng = new DiscreteRandomVariableGenerator(); _transitionRateMatrix = transitionRateMatrix; _currentTime = 0; _currentState = weatherState; }
public WeatherData(int currentTempeture, WeatherState currentState, DateTime currentDate, List <Tuple <int, WeatherState> > forecasts, string locationName) { this.CurrentTempeture = currentTempeture; this.CurrentState = currentState; this.CurrentDate = currentDate; this.Forecasts = forecasts; this.LocationName = locationName; }
private void SetSubWeathersImmediately(ConfigSubWeatherCollection subWeather) { this.SetSubWeathers(subWeather); this._currentSubWeather = subWeather; if (this._weatherState == WeatherState.WeatherTransit) { this._weatherState = WeatherState.Idle; this._weatherTransitionTimer.Reset(false); } }
public Weather(Game2D game) : base(game) { _cloud = new Cloud(game, new Vector2(400f, 100f)); _sun = new Sun(game, new Vector2(700f, 100f)); _sun._cloud = _cloud; _state = WeatherState.CLOUD; _suntex = game.Content.Load <Texture2D>("Textures\\sun_icon"); _cloudtex = game.Content.Load <Texture2D>("Textures\\rain_icon"); _font = game.Content.Load <SpriteFont>("Fonts\\Font"); }
string GetIcon(WeatherState state, bool isDay) { switch (state) { case WeatherState.ClearSky: return(isDay ? "clear-day" : "clear-night"); case WeatherState.ScatteredThunder: return(isDay ? "scattered-thunder-day" : "scattered-thunder-night"); case WeatherState.Thunder: return("thunder"); case WeatherState.LightDrizzle: return("light-dizzle"); case WeatherState.Drizzle: return("dizzle"); case WeatherState.LightRain: return(isDay ? "light-rain-day" : "light-rain-night"); case WeatherState.Rain: return("rain"); case WeatherState.FrezzingRain: return("frezzing-rain"); case WeatherState.LightSnow: return("light-snow"); case WeatherState.Snow: return("snow"); case WeatherState.SnowRain: return("rain-snow"); case WeatherState.LightDust: return(isDay ? "light-dust" : "dust"); case WeatherState.Dust: return("dust"); case WeatherState.LightClounds: return(isDay ? "light-cloudy-day" : "light-cloudy-night"); case WeatherState.MostlyClouds: return(isDay ? "mostly-cloudy-day" : "mostly-cloudy-night"); case WeatherState.Clouds: return("cloudy"); } return("unknown"); }
// Start is called before the first frame update void Start() { //初期天候を曇りに this.WS = WeatherState.Cloudy; this.player = GameObject.FindWithTag("Player"); this.playerController = player.GetComponent <PlayerController>(); this.gameManegement = GameObject.FindWithTag("GameManager").GetComponent <GameManagement>(); this.Start_CoolTime = false; this.nowTime = 0; }
public void Thunderstorm() { if (currentState == RainState) { currentState = ThunderstormState; StartCoroutine(RainEmission(emissionModule, 100, 250, 3.0f)); WeatherDisplay.GetComponent <WeatherDisplay>().WeatherChange(ThunderstormState); } else { Debug.LogError("Can't change from that state"); } }
protected override void Awake() { base.Awake(); WeatherState = ScriptableObject.CreateInstance(typeof(WeatherPreset)) as WeatherPreset; WeatherClampsMin = ScriptableObject.CreateInstance(typeof(WeatherPreset)) as WeatherPreset; WeatherClampsMax = ScriptableObject.CreateInstance(typeof(WeatherPreset)) as WeatherPreset; WeatherOverrides = ScriptableObject.CreateInstance(typeof(WeatherPreset)) as WeatherPreset; WeatherState.Reset(); WeatherClampsMin.Reset(); WeatherClampsMax.Reset(); WeatherOverrides.Reset(); Overrides = new LegacyWeatherState(WeatherOverrides); }
public List <double> GetStatisticalProcessingInfo(int sampleSize, double timeShift) { _stateDurations = new Dictionary <WeatherState, double>() { { WeatherState.Clear, 0d }, { WeatherState.Cloudy, 0d }, { WeatherState.Overcast, 0d }, }; // wait till stable state _ = SimulateAndGetInfo(timeShift); var k = 0; var sumOfDurations = 0d; while (k < sampleSize) { var teta = Math.Log(_baseRng.NextDouble()) / _transitionRateMatrix[(int)_currentState][(int)_currentState]; _currentTime += teta; var probMassFunc = new double[_transitionRateMatrix.Length]; for (var i = 0; i < _transitionRateMatrix.Length; i++) { if (i == (int)_currentState) { probMassFunc[i] = 0; continue; } probMassFunc[i] = -_transitionRateMatrix[(int)_currentState][i] / _transitionRateMatrix[(int)_currentState][(int)_currentState]; } _stateDurations[_currentState] += teta; sumOfDurations += teta; _currentState = (WeatherState)_discreteRng.GetRandomNumber(probMassFunc); k++; } var output = new List <double>(); foreach (var duration in _stateDurations.Values) { output.Add(duration / sumOfDurations); } return(output); }
public void Stop(WeatherSystem weatherSystem, float crossTime) { foreach (var weatherParticle in weatherParticles) { weatherParticle.Stop(); } if (crossTime >= 0) { _exitCrossTime = crossTime; } _stopTime = Time.time; _state = WeatherState.STOPPING; OnStop(weatherSystem); }
public virtual void Awake() { this._renderingDataStack = new FixedStack <RenderingDataTransition>(10, new Action <RenderingDataTransition, int, RenderingDataTransition, int>(this.OnRenderingDataChanged)); this._currentRendertingData = null; this._renderingDataTransitionTimer = new EntityTimer(0f); this._renderingDataTransitionTimer.SetActive(false); this._renderingDataState = RenderingDataState.Idle; this._mainCameraTransform = Camera.main.transform; this._subWeatherStack = new FixedStack <SubWeatherTransition>(5, new Action <SubWeatherTransition, int, SubWeatherTransition, int>(this.OnSubWeatherChanged)); this._rainPrefab = Miscs.LoadResource <GameObject>(this.RAIN_PREFAB_PATH, BundleType.RESOURCE_FILE); this._weatherState = WeatherState.Idle; this._weatherTransitionTimer = new EntityTimer(0f); this._weatherTransitionTimer.SetActive(false); }
// Start is called before the first frame update void Start() { ps.Stop(); sunnyState = gameObject.AddComponent <SunnyState>(); cloudyState = gameObject.AddComponent <CloudyState>(); rainingState = gameObject.AddComponent <RainState>(); currentState = sunnyState; cloud1.position = cloud1Pos[1]; cloud2.position = cloud2Pos[1]; ChangeWeather(); }
public static void HandleWeatherStatus(Packet packet) { WeatherState state = packet.ReadInt32E <WeatherState>("State"); float grade = packet.ReadSingle("Grade"); Bit unk = packet.ReadBit("Unk Bit"); // Type Storage.WeatherUpdates.Add(new WeatherUpdate { MapId = CoreParsers.MovementHandler.CurrentMapId, ZoneId = 0, // fixme State = state, Grade = grade, Unk = unk }, packet.TimeSpan); }
public WeatherDwarfModel( double currentTempeture, WeatherState currentState, DateTime currentDate, List <ForecastModel> forecasts, string locationName, WeatherUnit unit) { this.CurrentTempeture = currentTempeture; this.CurrentState = currentState; this.CurrentDate = currentDate; this.Forecasts = forecasts; this.LocationName = locationName; this.Unit = unit; }
public IntentExecutor( ILogger <IntentExecutor> logger, BringState bringState, RouteState routeState, SpotifyState spotifyState, HueState hueState, WeatherState weatherState, CalendarState calendarState, FuelState fuelState, ClockState clockState, VvsState vvsState, FitbitState fitbitState, GoogleFitState googleFitState, SoccerState bundesligaState, NewsState newsState) { _logger = logger; _bringState = bringState; _routeState = routeState; _spotifyState = spotifyState; _hueState = hueState; _weatherState = weatherState; _calendarState = calendarState; _fuelState = fuelState; _clockState = clockState; _vvsState = vvsState; _fitbitState = fitbitState; _googleFitState = googleFitState; _bundesligaState = bundesligaState; _newsState = newsState; _displayableDictionary = new Dictionary <Type, Displayable> { { typeof(BringState), bringState }, { typeof(RouteState), routeState }, { typeof(SpotifyState), spotifyState }, { typeof(HueState), hueState }, { typeof(WeatherState), weatherState }, { typeof(CalendarState), calendarState }, { typeof(FuelState), fuelState }, { typeof(ClockState), clockState }, { typeof(VvsState), vvsState }, { typeof(FitbitState), fitbitState }, { typeof(GoogleFitState), googleFitState }, { typeof(SoccerState), bundesligaState }, { typeof(NewsState), newsState }, }; }
/// <summary> /// Parses a received message into an eventTable. /// Fires an onReceiveEventTable event if successful /// </summary> /// <param name="content">The message that should be parsed</param> /// <param name="type">The expected type of the eventTable</param> /// <returns>Whether or not parsing the eventTable was successful</returns> private bool ParseEventTable(byte[] content, MessageType type) { List <EventState> eventStates = new List <EventState>(); using (BinaryReader reader = new BinaryReader(new MemoryStream(content))) { try { do { EventState state = null; switch (type) { case MessageType.EventTableValueStates: state = ValueState.Parse(reader); break; case MessageType.EventTableTextStates: state = TextState.Parse(reader); break; case MessageType.EventTableDaytimerStates: state = DaytimerState.Parse(reader); break; case MessageType.EventTableWeatherStates: state = WeatherState.Parse(reader); break; default: return(false); } eventStates.Add(state); } while (reader.BaseStream.Length - reader.BaseStream.Position > 0); } catch { return(false); } } if (OnReceiveEventTable != null) { OnReceiveEventTable.Invoke(this, new EventStatesParsedEventArgs(type, eventStates)); return(true); } else { return(false); } }
public void changeToNextWeather() { // print("current weather state = " + currentWeatherState); if (currentWeatherState == WeatherState.exiting) { GameObject wgo; switch (currentWeather) { case Weather.cloudy: wgo = weatherArray[(int)currentWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); if(wgo.transform.position.x < (offStage)) { currentWeatherState = WeatherState.entering; //reset position of weather sprite wgo.transform.position = new Vector3(-1 * offStage, wgo.transform.position.y, wgo.transform.position.z); } break; case Weather.fog: wgo = weatherArray[(int)currentWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); if(wgo.transform.position.x < (offStage)) { currentWeatherState = WeatherState.entering; //reset position of weather sprite wgo.transform.position = new Vector3(-1 * offStage, wgo.transform.position.y, wgo.transform.position.z); } break; case Weather.partlyCloudy: wgo = weatherArray[(int)currentWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); if(wgo.transform.position.x < (offStage)) { currentWeatherState = WeatherState.entering; //reset position of weather sprite wgo.transform.position = new Vector3(-1 * offStage, wgo.transform.position.y, wgo.transform.position.z); } break; case Weather.rainy: StopRain(); wgo = weatherArray[(int)currentWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); if(wgo.transform.position.x < (offStage)) { currentWeatherState = WeatherState.entering; //reset position of weather sprite wgo.transform.position = new Vector3(-1 * offStage, wgo.transform.position.y, wgo.transform.position.z); } break; case Weather.snow: StopSnow(); wgo = weatherArray[(int)currentWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); if(wgo.transform.position.x < (offStage)) { currentWeatherState = WeatherState.entering; //reset position of weather sprite wgo.transform.position = new Vector3(-1 * offStage, wgo.transform.position.y, wgo.transform.position.z); } break; case Weather.storm: wgo = weatherArray[(int)currentWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); if(wgo.transform.position.x < (offStage)) { isStorming = false; currentWeatherState = WeatherState.entering; //reset position of weather sprite wgo.transform.position = new Vector3(-1 * offStage, wgo.transform.position.y, wgo.transform.position.z); } break; case Weather.sunny: currentWeatherState = WeatherState.entering; break; } } if (currentWeatherState == WeatherState.entering) { GameObject wgo; switch (newWeather) { case Weather.cloudy: wgo = weatherArray[(int)newWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); //print("weather position " + wgo.transform.position.x); if(wgo.transform.position.x < 0) { currentWeatherState = WeatherState.stationary; //broadcast the transition is finished transitionFinishedEvent(); changingWeather = false; currentWeather = newWeather; } break; case Weather.fog: wgo = weatherArray[(int)newWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); //print("weather position " + wgo.transform.position.x); if(wgo.transform.position.x < 0) { currentWeatherState = WeatherState.stationary; //broadcast the transition is finished transitionFinishedEvent(); changingWeather = false; currentWeather = newWeather; } break; case Weather.partlyCloudy: wgo = weatherArray[(int)newWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); //print("weather position " + wgo.transform.position.x); if(wgo.transform.position.x < 0) { currentWeatherState = WeatherState.stationary; //broadcast the transition is finished transitionFinishedEvent(); changingWeather = false; currentWeather = newWeather; } break; case Weather.rainy: wgo = weatherArray[(int)newWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); //print("weather position " + wgo.transform.position.x); if(wgo.transform.position.x < 0) { foreGroundRain.GetComponent<ParticleSystem>().emissionRate = 20; midGroundRain.GetComponent<ParticleSystem>().emissionRate = 100; backGroundRain.GetComponent<ParticleSystem>().emissionRate = 60; currentWeatherState = WeatherState.stationary; //broadcast the transition is finished transitionFinishedEvent(); changingWeather = false; currentWeather = newWeather; } break; case Weather.snow: wgo = weatherArray[(int)newWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); //print("weather position " + wgo.transform.position.x); if(wgo.transform.position.x < 0) { foreGroundSnow.GetComponent<ParticleSystem>().emissionRate = 10; midGroundSnow.GetComponent<ParticleSystem>().emissionRate = 20; currentWeatherState = WeatherState.stationary; //broadcast the transition is finished transitionFinishedEvent(); changingWeather = false; currentWeather = newWeather; } break; case Weather.storm: wgo = weatherArray[(int)newWeather]; wgo.transform.Translate(new Vector3(-weatherTransitionSpeed * Time.deltaTime,0,0)); //print("weather position " + wgo.transform.position.x); if(wgo.transform.position.x < 0) { currentWeatherState = WeatherState.stationary; //broadcast the transition is finished //transitionFinishedEvent(); changingWeather = false; currentWeather = newWeather; isStorming = true; } break; case Weather.sunny: currentWeatherState = WeatherState.stationary; //broadcast the transition is finished transitionFinishedEvent(); changingWeather = false; currentWeather = newWeather; break; } } //switch clearing actions on w }
public void SendWeatherToClient(WeatherState state, MinecraftClient client) { if (client.World != World) throw new InvalidOperationException("Client must be in same world to change WeatherState!"); switch (state) { case WeatherState.Clear: client.SendPacket(new ChangeGameStatePacket(ChangeGameStatePacket.GameState.EndRaining)); break; case WeatherState.Raining: case WeatherState.Thundering: client.SendPacket(new ChangeGameStatePacket(ChangeGameStatePacket.GameState.BeginRaining)); break; } }
public void updateObserver(WeatherState weatherState, float weatherValue) { this.weatherState = weatherState; this.weatherValue = weatherValue; }
public void RandomizeWeather() { Weather = (WeatherState)Rand.Next(Enum.GetValues(typeof(WeatherState)).Length); }
// 날씨 입력 public void SetWeather(WeatherState weatherState, float weatherValue) { this.weatherState = weatherState; this.weatherValue = weatherValue; changeWeather(); }
public void SendWeather(WeatherState weather, UniversalCoords coords) { //throw new NotImplementedException(); }
internal void SetWeather(WeatherState weather) { foreach (Client c in GetClients()) { c.SendWeather(weather, (X << 4), (Z << 4)); } }
public void SendWeather(WeatherState weather, int i, int i1) { throw new NotImplementedException(); }
// Use this for initialization // Update is called once per frame void Update() { if (crossFading) { Color curSRColor = timeOfDay[(int)currentTOD].GetComponent<SpriteRenderer>().color;//.color.a -= 0.5f; timeOfDay[(int)currentTOD].GetComponent<SpriteRenderer>().color = new Vector4(curSRColor.a , curSRColor.g ,curSRColor.b, curSRColor.a - 0.02f); //Color newSR = timeOfDay[(int)newTOD].GetComponent<SpriteRenderer>().color; //timeOfDay[(int)newTOD].GetComponent<SpriteRenderer>().color = new Vector4(newSR.r, newSR.g, newSR.b, newSR.a + 0.02f); if(curSRColor.a <= 0) { crossFading = false; //place the transparent bg behind all the others timeOfDay[(int)currentTOD].transform.Translate(new Vector3(0,0, 4)); for(int i = 0;i < timeOfDay.Length; i++) { timeOfDay[i].transform.Translate(new Vector3(0,0, -1)); } resetBG(currentTOD); currentTOD = newTOD; inTransition = false; ChangeWeather(); currentWeatherState = WeatherState.exiting; //transitionFinishedEvent(); } } if (changingWeather) { changeToNextWeather(); } if (isStorming) { if(Time.time >= stormTime) { isStorming = false; LandContainer lc = landManager.GetComponent<LandContainer>(); lc.NewLand(); lc.UpdateLand(currentTOD); NextTimeOfDay(); } } }
public void CheckForStorm() { stormTime = Time.time + 8; isStorming = true; newWeather = Weather.storm; changingWeather = true; currentWeatherState = WeatherState.exiting; }
internal void SetWeather(WeatherState weather) { foreach (Client c in GetClients()) { c.SendWeather(weather, Coords); } }
public void SetWeather(WeatherState state) { this.next = state; this.GetComponent<Animator>().SetTrigger("doFadeOut"); }