public void Draw(Level level, Actor actor) { var actorshape = new Ellipse(); actorshape.Height = HEIGHT_PIXELS * CIRCLE_PERCENTAGE; actorshape.Width = WIDTH_PIXELS * CIRCLE_PERCENTAGE; actorshape.Fill = ActorColor(actor); Canvas.SetTop(actorshape, HEIGHT_PIXELS * (0.5 * (1-CIRCLE_PERCENTAGE) + (level.Height -1- actor.y))); Canvas.SetLeft(actorshape, WIDTH_PIXELS * (0.5 * (1 - CIRCLE_PERCENTAGE) + actor.x)); canvas.Children.Add(actorshape); }
public static SolidColorBrush ActorColor(Actor actor) { SolidColorBrush colorBrush = new SolidColorBrush(); if (actor is Target) colorBrush.Color = Colors.Gold; else if (actor is Arrow) colorBrush.Color = Colors.Red; else if (actor is Player) colorBrush.Color = Colors.Black; else colorBrush.Color = Colors.DarkBlue; return colorBrush; }