/// <summary> /// Called when the bottom right cell is clicked /// </summary> /// <param name="sender">Sender of the event</param> /// <param name="e">Event arguments for the event</param> private void BottomRightClicked(object sender, RoutedEventArgs e) { // Get the current entity ent current = ServiceLocator.Instance.Entity.Entity; if (String.IsNullOrWhiteSpace(current.Graphic)) { return; } // Get the current graphic BaseGraphic graphic = ServiceLocator.Instance.Level.Level.Graphics.Where(g => g.ID == current.Graphic).First(); if (graphic == null) { return; } // Capture the size Size size = graphic.GetSize(); // Create a point for the entity that represents the top right double x = 1334 + (size.Width / 2); double y = 750 + (size.Height / 2); // Set the point ServiceLocator.Instance.Entity.SetPoint(x, y); }
/// <summary> /// Called when the bottom middle center is clicked /// </summary> /// <param name="sender">Sender of the event</param> /// <param name="e">Event arguments for the event</param> private void BottomCenterClicked(object sender, RoutedEventArgs e) { // Get the button Button button = (Button)sender; // Get the canvas Canvas grid = (Canvas)((Grid)(button.Parent)).Parent; // Get the mouse position on the canvas Point position = Mouse.GetPosition(canvas); // Get the current entity ent current = ServiceLocator.Instance.Entity.Entity; if (String.IsNullOrWhiteSpace(current.Graphic)) { return; } // Get the current graphic BaseGraphic graphic = ServiceLocator.Instance.Level.Level.Graphics.Where(g => g.ID == current.Graphic).First(); if (graphic == null) { return; } // Capture the size Size size = graphic.GetSize(); // Create a point for the entity that represents the top center double x = position.X - 166.75; double y = 750 + (size.Height / 2); // Set the point ServiceLocator.Instance.Entity.SetPoint(x, y); }