private static void onTopLeftChanged(object sender, DependencyPropertyChangedEventArgs args) { SeesawObject s = (SeesawObject)sender; Canvas.SetLeft(s, ((Point)args.NewValue).X); Canvas.SetTop(s, ((Point)args.NewValue).Y); }
public void AddObject(SeesawObject obj, bool isLeft = true) { if (isLeft) { leftBallPanel.Children.Add(obj); } else { rightBallPanel.Children.Add(obj); } }
public void RemoveObject(SeesawObject obj, bool isLeft = true) { if (isLeft) { leftBallPanel.Children.Remove(obj); } else { rightBallPanel.Children.Remove(obj); } }
/// <summary> /// Pushes a ball from the HeldBalls section in the assumption that it'll trigger an animation /// </summary> /// <param name="ball">The ball to remove</param> public bool PushBall(SeesawObject ball) { if (ball == null) return false; int ballOneIdx = this.PlayerOneHeldBalls.IndexOf(ball); int ballTwoIdx = this.PlayerTwoHeldBalls.IndexOf(ball); if (ballOneIdx > -1) this.PlayerOneHeldBalls[ballOneIdx] = null; else if (ballTwoIdx > -1) this.PlayerTwoHeldBalls[ballTwoIdx] = null; else return false; return true; }
/// <summary> /// Adds a ball to the balance /// </summary> /// <param name="ball"></param> /// <param name="leftSide"></param> public void AddBallToBalance(SeesawObject ball, bool leftSide) { if (leftSide) { LeftBalanceBalls.Add(ball); } else { RightBalanceBalls.Add(ball); } }
public static Point GetTopLeft(SeesawObject pc) { return(pc.TopLeft); }
public static void SetTopLeft(SeesawObject pc, Point value) { pc.TopLeft = value; }