Example #1
0
 private void G_Switch_OnMouseDownEvent(Vector2 arg1, System.Windows.Forms.MouseButtons arg2)
 {
     if (ContentBounds.Contains(ContentView.GetMouseWorldCoordinate()) && (ContentView.GetMouseWorldCoordinate() - Position).Length() <= 0.6f)
     {
         Powered = !Powered;
     }
 }
Example #2
0
        public override void Update()
        {
            var mP = ContentView.GetMouseWorldCoordinate();

            Pointed = Contained(mP.X, mP.Y, RingPosition.X - RingRadius, RingPosition.Y - RingRadius, RingPosition.X + RingRadius, RingPosition.Y + RingRadius);
            if (ContentView.Cutting && !ContentView.CurrentP1.Equals(this))
            {
                var cs = ContentView.Cables.Where(c =>
                                                  (c.P1.Equals(ContentView.CurrentP1) && c.P2.Equals(this)) ||
                                                  (c.P1.Equals(this) && c.P2.Equals(ContentView.CurrentP1)));
                if (cs.Count() > 0)
                {
                    if (Pointed)
                    {
                        cs.ElementAt(0).Signed = true;
                    }
                    else
                    {
                        cs.ElementAt(0).Signed = false;
                    }
                }
            }
        }