示例#1
0
 private bool CheckGenerateBall(BallController ball)
 {
     if (CountLeftBall(ball, 1) > 2 || CountDownBall(ball, 1) > 2)
     {
         return(false);
     }
     return(true);
 }
示例#2
0
 private int CountDownBall(BallController ball, int count)
 {
     if (ball.Positinon.Y > 0)
     {
         var newBall = _balls[ball.Positinon.X, ball.Positinon.Y - 1];
         if (ball.TypeBall == newBall.TypeBall)
         {
             return(CountDownBall(newBall, count + 1));
         }
     }
     return(count);
 }
示例#3
0
 private ICollection <BallController> CountUpBall(BallController ball, ICollection <BallController> balls, BallController[,] newGamePole)
 {
     if (ball.Positinon.Y < _sizeGamePole.Y - 1)
     {
         var newBall = newGamePole[ball.Positinon.X, ball.Positinon.Y + 1];
         if (newBall != null && ball.TypeBall == newBall.TypeBall)
         {
             balls.Add(newBall);
             return(CountUpBall(newBall, balls, newGamePole));
         }
     }
     return(balls);
 }
示例#4
0
 private ICollection <BallController> CountLeftBall(BallController ball, ICollection <BallController> balls, BallController[,] newGamePole)
 {
     if (ball.Positinon.X > 0)
     {
         var newBall = newGamePole[ball.Positinon.X - 1, ball.Positinon.Y];
         if (newBall != null && ball.TypeBall == newBall.TypeBall)
         {
             balls.Add(newBall);
             return(CountLeftBall(newBall, balls, newGamePole));
         }
     }
     return(balls);
 }
示例#5
0
        public bool CheckChangedBall(BallController ball, BallController[,] newGamePole, bool destoed)
        {
            bool change = false;
            ICollection <BallController> balls = new List <BallController> {
                ball
            };

            CountLeftBall(ball, balls, newGamePole);
            CountRightBall(ball, balls, newGamePole);

            if (balls.Count > 2)
            {
                change = true;
                if (destoed)
                {
                    foreach (var destroedBall in balls)
                    {
                        destroedBall.IsDestroed = true;
                    }
                }
            }
            balls = new List <BallController> {
                ball
            };

            CountDownBall(ball, balls, newGamePole);
            CountUpBall(ball, balls, newGamePole);
            if (balls.Count > 2)
            {
                change = true;
                if (destoed)
                {
                    foreach (var destroedBall in balls)
                    {
                        destroedBall.IsDestroed = true;
                    }
                }
            }
            balls.Clear();
            return(change);
        }
示例#6
0
 private void OnSuccessBall(GamePole.BallController ball)
 {
     _ball = ball;
 }
示例#7
0
 public MoveReverce(BallController ball)
 {
     _ball      = ball;
     _ballkoord = ball.View.Ball.anchoredPosition;
     _ballPoint = ball.Positinon;
 }