void model_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
PlayerViewModel model = sender as PlayerViewModel;
if (e.PropertyName == "CurrentPhase")
{
if (model.CurrentPhase == Core.Games.TurnPhase.Inactive)
{
imgPhase.Visibility = System.Windows.Visibility.Hidden;
}
else
{
imgPhase.Visibility = System.Windows.Visibility.Visible;
Storyboard animation = Resources["sbPhaseChange"] as Storyboard;
animation.Begin(this);
}
}
else if (e.PropertyName == "IsDead")
{
Storyboard deathAnimation = (Resources["sbDeathTransition"] as Storyboard);
Trace.Assert(deathAnimation != null);
if (model.IsDead)
{
deathAnimation.Begin(this);
}
else
{
deathIcon.BeginAnimation(Image.OpacityProperty, null);
deathIcon.Opacity = 0.0d;
deathEffect.BeginAnimation(Effects.MonochromeEffect.StrengthProperty, null);
deathEffect.Strength = 0.0d;
deathAnimation.Stop();
deathAnimation.Remove(this);
}
}
}