Ejemplo n.º 1
0
        public void OnClick(Object o, MouseEventArgs mea)
        {
            Gridpoint _firstPoint  = null;
            Gridpoint _secondPoint = null;

            Console.WriteLine("MouseClick Cords: " + mea.Location);

            if (firstClick)
            {
                _firstPoint = Gridpoints.Find(x => x.Collision(mea.Location));
                if (_firstPoint != null)
                {
                    Console.WriteLine("First PointClick!");
                    Console.WriteLine(_firstPoint.Cords);
                    this.firstClick = false;
                    this.firstPoint = _firstPoint;
                }
            }
            else
            {
                _secondPoint = Gridpoints.Find(x => x.Collision(mea.Location));
                if (_secondPoint != null && _secondPoint != _firstPoint)
                {
                    Console.WriteLine("Second PointClick!");
                    Console.WriteLine(_secondPoint.Cords);
                    this.secondPoint = _secondPoint;

                    builder.BuildRoad(this.firstPoint.Cords, this.secondPoint.Cords);
                    this.ResetPoints();
                }
            }
        }
Ejemplo n.º 2
0
 private void ResetPoints()
 {
     this.firstPoint  = null;
     this.secondPoint = null;
     this.firstClick  = true;
 }