public void ChangeCondition(WeatherCondition condition, bool isnight, bool issummer) { ResetCondition(); this.condition = condition; if (Canvas == null) { return; } isNight = isnight; isSummer = issummer; switch (condition) { case WeatherCondition.unknown: return; case WeatherCondition.sunny: SetSunny(); break; case WeatherCondition.cloudy: case WeatherCondition.few_clouds: case WeatherCondition.partly_cloudy: SetCloudy(0); break; case WeatherCondition.overcast: SetCloudy(1); break; case WeatherCondition.windy: case WeatherCondition.calm: case WeatherCondition.light_breeze: case WeatherCondition.moderate: case WeatherCondition.fresh_breeze: case WeatherCondition.strong_breeze: case WeatherCondition.high_wind: case WeatherCondition.gale: SetSunny(); break; case WeatherCondition.strong_gale: case WeatherCondition.storm: case WeatherCondition.violent_storm: case WeatherCondition.hurricane: case WeatherCondition.tornado: case WeatherCondition.tropical_storm: SetWind(); break; case WeatherCondition.shower_rain: case WeatherCondition.heavy_shower_rain: SetShower(); break; case WeatherCondition.thundershower: case WeatherCondition.heavy_thunderstorm: case WeatherCondition.hail: SetThunderShower(); break; case WeatherCondition.light_rain: SetRain(0); break; case WeatherCondition.moderate_rain: SetRain(1); break; case WeatherCondition.heavy_rain: case WeatherCondition.extreme_rain: SetRain(2); break; case WeatherCondition.drizzle_rain: SetRain(0); break; case WeatherCondition.storm_rain: case WeatherCondition.heavy_storm_rain: case WeatherCondition.severe_storm_rain: SetRain(3); break; case WeatherCondition.freezing_rain: SetRain(0); break; case WeatherCondition.light_snow: case WeatherCondition.moderate_snow: SetSnow(0); break; case WeatherCondition.heavy_snow: case WeatherCondition.snowstorm: SetSnow(1); break; case WeatherCondition.sleet: case WeatherCondition.rain_snow: case WeatherCondition.shower_snow: case WeatherCondition.snow_flurry: SetSnow(0); break; case WeatherCondition.mist: case WeatherCondition.foggy: SetFog(); break; case WeatherCondition.haze: case WeatherCondition.sand: case WeatherCondition.dust: case WeatherCondition.volcanic_ash: case WeatherCondition.duststorm: case WeatherCondition.sandstorm: SetHaze(); break; case WeatherCondition.hot: SetHot(); break; case WeatherCondition.cold: SetCold(); break; default: break; } BGAnimation.Begin(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { // Background BackgroundAnimation = new BGAnimation(Grid_Main, Grid_Main, this.Game, this); Grid_Main.Background = BackgroundAnimation.InitializeAnimation(); BackgroundAnimation.StartColorAnimation(); BackgroundAnimation.StartBlockAnimation(150); //{ // Storyboard storyboard = new Storyboard(); // ThicknessAnimation da = new ThicknessAnimation(); // da.From = new Thickness(-10, -10, 0, 0); // da.To = new Thickness(10, 10, 0, 0); // da.RepeatBehavior = RepeatBehavior.Forever; // da.Duration = TimeSpan.FromMilliseconds(1000); // storyboard.AutoReverse = true; // storyboard.Children.Add(da); // Storyboard.SetTarget(da, Grid_MainStructure); // Storyboard.SetTargetProperty(da, new PropertyPath(Grid.MarginProperty)); // storyboard.Begin(Grid_MainStructure); //} // <Grid.RenderTransform> // <TransformGroup> // <ScaleTransform/> // <SkewTransform/> // <RotateTransform/> // <TranslateTransform X="10"/> // </TransformGroup> //</Grid.RenderTransform> { { var tg = new TransformGroup(); var translation = new TranslateTransform(0, 0); var translationName = "myTranslation"; RegisterName(translationName, translation); tg.Children.Add(translation); Grid_MainStructure.RenderTransform = tg; } //{ // var translation = new TranslateTransform(0, 0); // var translationName = "myTranslation2"; // RegisterName(translationName, translation); // TransformGroup_Cockpit.Children.Add(translation); // //this.Image_Cockpit.RenderTransform = tg; //} //var anim = new DoubleAnimation(3, 100, new Duration(new TimeSpan(0, 0, 0, 1, 0))) //{ // EasingFunction = new PowerEase { EasingMode = EasingMode.EaseOut } //}; AnimateSchlingern(10, SchlingernDuration, TranslateTransform.YProperty); AnimateSchlingern(10, SchlingernDuration, TranslateTransform.XProperty); } }