/// <summary> /// Converts a UFO into a Geometry /// </summary> /// <param name="value">The UFO</param> /// <param name="targetType">The parameter is not used.</param> /// <param name="parameter">The parameter is not used.</param> /// <param name="culture">The parameter is not used.</param> /// <returns>Returns a Geometry containing the UFO</returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Ufo ufo = (Ufo)value; RectangleGeometry uGeo = new RectangleGeometry(new Rect(ufo.Position.X, ufo.Position.Y, Ufo.W, Ufo.H)); return(uGeo); }
/// <summary> /// Generates a new UFO /// </summary> /// <returns>Returns the UFO generated</returns> public Ufo GenerateUfo() { Ufo ufo; int startX = 1; int targetX = (int)Math.Round(Cw - 2, 0); int hp = MainWindow.R.Next(2, 4); if (MainWindow.R.Next(0, 2) == 1) { startX = targetX; targetX = 2; } Point start = new Point(startX, MainWindow.R.Next(1, (int)Math.Round(Ch * 0.2, 0))); ufo = new Ufo(start, targetX, hp, GenerateEngine(false)); return(ufo); }