예제 #1
0
        internal void MoveBall(Item item, RoomUser mover, Point user)
        {
            try
            {
                item.Direction = ComeDirection.GetComeDirection(user, item.Coordinate);
                if (item.Direction != Direction.Null)
                {
                    MoveBallProcess(item, mover);
                }

                _room.OnUserShoot(mover, item);
            }
            catch
            {
            }
        }
        public void MoveBall(Item item, GameClient client, Point user, bool skip = false)
        {
            try
            {
                item.comeDirection = ComeDirection.GetComeDirection(user, item.Coordinate);

                if (item.comeDirection != IComeDirection.Null)
                {
                    // item.ballMover = client;
                    new TaskFactory().StartNew(() => MoveBallProcess(item, skip));
                }
            }
            catch
            {
            }
        }
예제 #3
0
        internal void OnUserWalk(RoomUser User)
        {
            if (User == null)
            {
                return;
            }

            foreach (Item ball in Balls.Values)
            {
                if (ball == null)
                {
                    return;
                }

                if (User.SetX == ball.GetX && User.SetY == ball.GetY && User.GoalX == ball.GetX &&
                    User.GoalY == ball.GetY && User.handelingBallStatus == 0) // super chute.
                {
                    Point userPoint = new Point(User.X, User.Y);
                    ball.ExtraData    = "55";
                    ball.ballIsMoving = true;
                    ball._iBallValue  = 1;
                    MoveBall(ball, User, userPoint);
                }
                else if (User.X == ball.GetX && User.Y == ball.GetY && User.handelingBallStatus == 0)
                {
                    Point userPoint = new Point(User.SetX, User.SetY);
                    ball.ExtraData    = "55";
                    ball.ballIsMoving = true;
                    ball._iBallValue  = 1;
                    MoveBall(ball, User, userPoint);
                }
                else
                {
                    if (User.handelingBallStatus == 0 && User.GoalX == ball.GetX && User.GoalY == ball.GetY)
                    {
                        return;
                    }

                    if (User.SetX == ball.GetX && User.SetY == ball.GetY && User.IsWalking &&
                        (User.X != User.GoalX || User.Y != User.GoalY))
                    {
                        User.handelingBallStatus = 1;
                        Point userPoint = new Point(User.X, User.Y);
                        ball.ExtraData    = "11";
                        ball.ballIsMoving = true;
                        ball._iBallValue  = 1;
                        MoveBall(ball, User, userPoint);

                        Direction _comeDirection = ComeDirection.GetComeDirection(new Point(User.X, User.Y), ball.Coordinate);
                        if (_comeDirection != Direction.Null)
                        {
                            int NewX = User.SetX;
                            int NewY = User.SetY;

                            ComeDirection.GetNewCoords(_comeDirection, ref NewX, ref NewY);
                            if (ball.GetRoom().GetGameMap().ValidTile(NewX, NewY))
                            {
                                ball.ExtraData = "11";
                                MoveBall(ball, User, NewX, NewY);
                            }
                        }
                    }
                }
            }
        }
        internal void OnUserWalk(RoomUser User)
        {
            if (User == null)
            {
                return;
            }

            foreach (Item ball in _balls.Values)
            {
                if (ball == null)
                {
                    return;
                }

                //If user position is same as ball position AND The goal Y is the same as Ball y position SHOOT!
                if (User.SetX == ball.GetX && User.SetY == ball.GetY && User.GoalX == ball.GetX && User.GoalY == ball.GetY && User.handelingBallStatus == 0) // super chute.
                {
                    Point userPoint = new Point(User.X, User.Y);
                    ball.ExtraData        = "55";
                    ball.BallTryGoThrough = 0;
                    ball.Shoot            = true;
                    ball.ballIsMoving     = true;
                    ball.ballMover        = User.GetClient();
                    MoveBall(ball, User.GetClient(), userPoint);
                }

                //if user position is same as ball //shoot!  SHOOT!
                else if (User.X == ball.GetX && User.Y == ball.GetY && User.handelingBallStatus == 0)
                {
                    Point userPoint = new Point(User.SetX, User.SetY);
                    ball.ExtraData        = "55";
                    ball.BallTryGoThrough = 0;
                    ball.Shoot            = true;
                    ball.ballIsMoving     = true;
                    ball.ballMover        = User.GetClient();
                    MoveBall(ball, User.GetClient(), userPoint);
                }
                else
                {
                    //if user goal is same as ball position
                    if (User.handelingBallStatus == 0 && User.GoalX == ball.GetX && User.GoalY == ball.GetY)
                    {
                        return;
                    }

                    if (User.SetX == ball.GetX && User.SetY == ball.GetY && User.IsWalking && (User.X != User.GoalX || User.Y != User.GoalY))
                    {
                        User.handelingBallStatus = 1;
                        IComeDirection _comeDirection = ComeDirection.GetComeDirection(new Point(User.X, User.Y), ball.Coordinate);
                        if (_comeDirection != IComeDirection.Null)
                        {
                            int NewX = User.SetX;
                            int NewY = User.SetY;

                            ComeDirection.GetNewCoords(_comeDirection, ref NewX, ref NewY);
                            if (ball.GetRoom().GetGameMap().ValidTile(NewX, NewY))
                            {
                                ball.ExtraData = "11";
                                ball.ballMover = User.GetClient();
                                MoveBall(ball, User.GetClient(), NewX, NewY);
                            }
                        }
                    }
                }
            }
        }