public void RefreshField(bool visible) { UpdateBackground(); this.Children.Clear(); if (this.Field != null) { this.Children.Add(background); if (visible) { if (this.Field.Objects.Count > 0) { if (this.Field.Objects.Count == 1) { Image objectImage = ImageLoader.CreaObjectImage(Field.Objects[0]); this.Children.Add(objectImage); } else { Image objectImage = ImageLoader.LoadImage("chest.png"); this.Children.Add(objectImage); } } if (this.Field.Creature != null) { Image creatureImage = ImageLoader.CreateCreatureImage(this.Field.Creature); this.Children.Add(creatureImage); Line healthBar = new Line(); healthBar.Stroke = Brushes.LightGreen; healthBar.X1 = 2; healthBar.Y1 = 2; healthBar.X2 = ((double)this.Field.Creature.Health / this.Field.Creature.MaxHealth) * 30 + 2; healthBar.Y2 = 2; healthBar.StrokeThickness = 2; this.Children.Add(healthBar); } } else { Rectangle rectangle = new Rectangle(); rectangle.Width = 30; rectangle.Height = 30; rectangle.Fill = new SolidColorBrush(Colors.Black); rectangle.Opacity = 0.5; this.Children.Add(rectangle); } } }