public EntityOverlayControl(Entity c, bool IsSelf = false) { this.InitializeComponent(); if (c == null) { throw new ArgumentNullException("c"); } this.Model = new EntityOverlayControlViewModel { NameColor = this.GetColor(c, IsSelf), Name = c.Name, Icon = EntityOverlayControl.GetIcon(c) }; base.DataContext = this.Model; }
public void Update(Entity c) { this.Model.Name = ((!string.IsNullOrWhiteSpace(c.Name)) ? c.Name : (c.GetType().Name + " No Name")); if (c is PC) { this.RotateImage(-c.HeadingDegree); return; } if (c is EObject) { this.Model.Icon = EntityOverlayControl.GetIcon(c); if (string.IsNullOrWhiteSpace(c.Name) && ((EObject)c).SubType == EObjType.Hoard) { this.Model.Name = "Hoard!"; return; } } else if (c is Combatant && ((Combatant)c).CurrentHP == 0u) { base.Visibility = Visibility.Hidden; } }