private static void OnHealthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { HealthBar bar = (HealthBar)d; int oldHealth = (int)e.OldValue; int newHealth = (int)e.NewValue; bar.Repaint(); if (newHealth < oldHealth) { bar.PlayLoseHealthAnimation(oldHealth, newHealth); } }
static void OnMaxHealthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { HealthBar bar = (HealthBar)d; bar.Repaint(); }