/// <summary> /// Finishes initialization of this object. /// </summary> /// <param name="sender">This object.</param> /// <param name="e">Details of the event.</param> private void OnLoaded(object sender, EventArgs e) { MainViewModel vm = DataContext as MainViewModel; if (vm != null) { PointsObject = vm.World.Region.SubAreas[SubAreaID].PowerPoints[PointsID]; PointsObject.PropertyChanged += OnPointsPropChanged; MouseDown += OnMouseDown; } Update(); }
/// <summary> </summary> private void LeftSpawn() { Moving = Direction.Right; World.Points edge = World.Overworld.SpawnLeftEdge; int top = edge.Start.Y; int bottom = edge.End.Y - this.Height; this.Left = edge.Start.X - this.Width; this.Top = random.Next(top, bottom); }
/// <summary> </summary> private void TopSpawn() { Moving = Direction.Down; World.Points edge = World.Overworld.SpawnTopEdge; int left = edge.Start.X; int right = edge.End.X - this.Width; this.Left = random.Next(left, right); this.Top = -this.Height; }
/// <summary> </summary> private void BottomSpawn() { Moving = Direction.Up; World.Points edge = World.Overworld.SpawnBottomEdge; int left = edge.Start.X; int right = edge.End.X - this.Width; this.Left = random.Next(left, right); this.Top = edge.Start.Y; }