示例#1
0
        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);
        }
示例#2
0
 public void AddObject(SeesawObject obj, bool isLeft = true)
 {
     if (isLeft)
     {
         leftBallPanel.Children.Add(obj);
     }
     else
     {
         rightBallPanel.Children.Add(obj);
     }
 }
示例#3
0
 public void RemoveObject(SeesawObject obj, bool isLeft = true)
 {
     if (isLeft)
     {
         leftBallPanel.Children.Remove(obj);
     }
     else
     {
         rightBallPanel.Children.Remove(obj);
     }
 }
示例#4
0
        /// <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;
        }
示例#5
0
 /// <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);
     }
 }
示例#6
0
 public static Point GetTopLeft(SeesawObject pc)
 {
     return(pc.TopLeft);
 }
示例#7
0
 public static void SetTopLeft(SeesawObject pc, Point value)
 {
     pc.TopLeft = value;
 }