public void onUserwalk(RoomUser User, RoomItem ball) { if (User == null) { return; } 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; ball.ballMover = User; MoveBall(ball, User.GetClient(), 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; ball.ballMover = User; MoveBall(ball, User.GetClient(), 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; ComeDirection _comeDirection = _ComeDirection.GetComeDirection(new Point(User.X, User.Y), ball.Coordinate); if (_comeDirection != ComeDirection.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 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 { } }
internal static void GetNewCoords(ComeDirection comeWith, ref int newX, ref int newY) { try { if (comeWith == ComeDirection.UP) { // newX = newX; newY++; } else if (comeWith == ComeDirection.UP_RIGHT) { newX--; newY++; } else if (comeWith == ComeDirection.RIGHT) { newX--; // newY = newY; } else if (comeWith == ComeDirection.DOWN_RIGHT) { newX--; newY--; } else if (comeWith == ComeDirection.DOWN) { // newX = newX; newY--; } else if (comeWith == ComeDirection.DOWN_LEFT) { newX++; newY--; } else if (comeWith == ComeDirection.LEFT) { newX++; // newY = newY; } else if (comeWith == ComeDirection.UP_LEFT) { newX++; newY++; } } catch { } }
internal static ComeDirection InverseDirections(Room room, ComeDirection comeWith, int x, int y) { try { if (comeWith == ComeDirection.UP) { return(ComeDirection.DOWN); } else if (comeWith == ComeDirection.UP_RIGHT) { return(ComeDirection.DOWN_LEFT); } else if (comeWith == ComeDirection.RIGHT) { return(ComeDirection.LEFT); } else if (comeWith == ComeDirection.DOWN_RIGHT) { return(ComeDirection.UP_LEFT); } else if (comeWith == ComeDirection.DOWN) { return(ComeDirection.UP); } else if (comeWith == ComeDirection.DOWN_LEFT) { return(ComeDirection.UP_RIGHT); } else if (comeWith == ComeDirection.LEFT) { return(ComeDirection.RIGHT); } else if (comeWith == ComeDirection.UP_LEFT) { return(ComeDirection.DOWN_RIGHT); } return(ComeDirection.NULL); } catch { return(ComeDirection.NULL); } }
internal static ComeDirection GetInverseDirectionEasy(ComeDirection comeWith) { try { if (comeWith == ComeDirection.UP) { return(ComeDirection.DOWN); } else if (comeWith == ComeDirection.UP_RIGHT) { return(ComeDirection.DOWN_LEFT); } else if (comeWith == ComeDirection.RIGHT) { return(ComeDirection.LEFT); } else if (comeWith == ComeDirection.DOWN_RIGHT) { return(ComeDirection.UP_LEFT); } else if (comeWith == ComeDirection.DOWN) { return(ComeDirection.UP); } else if (comeWith == ComeDirection.DOWN_LEFT) { return(ComeDirection.UP_RIGHT); } else if (comeWith == ComeDirection.LEFT) { return(ComeDirection.RIGHT); } else if (comeWith == ComeDirection.UP_LEFT) { return(ComeDirection.DOWN_RIGHT); } return(ComeDirection.NULL); } catch { return(ComeDirection.NULL); } }
public void MoveBallProcess(RoomItem item) { int tryes = 0; int newX = item.Coordinate.X; int newY = item.Coordinate.Y; int resetX; int resetY; while (tryes < 3) { if (room == null) { return; } if (room.GetGameMap() == null) { room.FixGameMap(); if (room.GetGameMap() == null) { return; } } if (item.comeDirection == ComeDirection.NULL) { item.ballIsMoving = false; break; } resetX = newX; resetY = newY; _ComeDirection.GetNewCoords(item.comeDirection, ref newX, ref newY); if (room.GetGameMap().SquareHasUsers(newX, newY)) // break 100 %, cannot return the ball { if (!(item._iBallValue == 1 || item._iBallValue == 2)) // Si está a 1c o 2c, atraviesa al otro usuario. { RoomUser userTile = room.GetRoomUserManager().GetUserForSquare(newX, newY); if (userTile != null && userTile.IsWalking) { ComeDirection cd = _ComeDirection.GetUserComeDirection(userTile); if (_ComeDirection.GetInverseDirectionEasy(item.comeDirection) == cd || userTile.GoalX == newX && userTile.GoalY == newY) { item._iBallValue = 6; } } else { item.ballIsMoving = false; break; } } } if (!room.GetGameMap().itemCanBePlacedHere(newX, newY)) // start the second game ball... inversing: { item.comeDirection = _ComeDirection.InverseDirections(room, item.comeDirection, newX, newY); newX = resetX; newY = resetY; tryes++; if (tryes > 2) { item.ballIsMoving = false; } continue; } if (MoveBall(item, item.ballMover, newX, newY)) { item.ballIsMoving = false; break; } int Number = 11; int.TryParse(item.ExtraData, out Number); if (Number > 11) { item.ExtraData = (int.Parse(item.ExtraData) - 11).ToString(); } item._iBallValue++; if (item._iBallValue > 6) { item.ballIsMoving = false; item._iBallValue = 1; item.ballMover = null; } break; } }
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); } } } } } }
public void onUserwalk(RoomUser User, RoomItem ball) { if (User == null) { return; } if (ball == null) { return; } var Height = room.GetGameMap().SqAbsoluteHeight(User.SetX, User.SetY); foreach (ThreeDCoord tile in ball.GetAffectedTiles.Values) { if (ball.GetZ != Height) { ball.SetHeight(Height); } } if (User.SetX == ball.GetX && User.SetY == ball.GetY && (ball._iBallValue == 5 || ball._iBallValue == 6)) // start the second game ball... inversing: { } else 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; ball.ballMover = User; MoveBall(ball, User.GetClient(), userPoint); } else if (User.SetX == ball.GetX && User.SetY == ball.GetY && User.GoalX == ball.GetX && User.GoalY == ball.GetY && User.handelingBallStatus == 1) // super chute quando para de andar { User.handelingBallStatus = 0; ComeDirection _comeDirection = _ComeDirection.GetComeDirection(new Point(User.X, User.Y), ball.Coordinate); if (_comeDirection != ComeDirection.NULL) { int NewX = User.SetX; int NewY = User.SetY; _ComeDirection.GetNewCoords(_comeDirection, ref NewX, ref NewY); if (ball.GetRoom().GetGameMap().ValidTile(NewX, NewY)) { Point userPoint = new Point(User.X, User.Y); //ball.ExtraData = "55"; ball.ballIsMoving = true; ball._iBallValue = 6; ball.ballMover = User; MoveBall(ball, User.GetClient(), 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; ball.ballMover = User; MoveBall(ball, User.GetClient(), 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; ComeDirection _comeDirection = _ComeDirection.GetComeDirection(new Point(User.X, User.Y), ball.Coordinate); if (_comeDirection != ComeDirection.NULL) { int NewX = User.SetX; int NewY = User.SetY; _ComeDirection.GetNewCoords(_comeDirection, ref NewX, ref NewY); if (!room.GetGameMap().itemCanBePlacedHere(NewX, NewY) && User.handelingBallStatus == 1) { ball.comeDirection = _ComeDirection.InverseDirections(room, ball.comeDirection, NewX, NewY); NewX = User.X; NewY = User.Y; ball.ExtraData = "11"; MoveBall(ball, User, NewX, NewY); } else if (room.GetGameMap().SquareHasUsers(NewX, NewY) && User.handelingBallStatus == 1) { ball.comeDirection = _ComeDirection.InverseDirections(room, ball.comeDirection, NewX, NewY); NewX = User.X; NewY = User.Y; ball.ExtraData = "11"; MoveBall(ball, User, NewX, NewY); } else if (ball.GetRoom().GetGameMap().ValidTile(NewX, NewY, true)) { ball.ExtraData = "11"; MoveBall(ball, User, NewX, NewY); } else { ball.comeDirection = _ComeDirection.InverseDirections(room, ball.comeDirection, NewX, NewY); NewX = User.X; NewY = User.Y; ball.ExtraData = "11"; MoveBall(ball, User, NewX, NewY); } } } } }
internal static void GetNewCoords(ComeDirection comeWith, ref int newX, ref int newY) { checked { try { if (comeWith == ComeDirection.UP) { newY++; } else { if (comeWith == ComeDirection.UP_RIGHT) { newX--; newY++; } else { if (comeWith == ComeDirection.RIGHT) { newX--; } else { if (comeWith == ComeDirection.DOWN_RIGHT) { newX--; newY--; } else { if (comeWith == ComeDirection.DOWN) { newY--; } else { if (comeWith == ComeDirection.DOWN_LEFT) { newX++; newY--; } else { if (comeWith == ComeDirection.LEFT) { newX++; } else { if (comeWith == ComeDirection.UP_LEFT) { newX++; newY++; } } } } } } } } } catch { } } }
internal void MoveBallProcess(Item item, RoomUser user) { { int tryes = 0; int newX = item.Coordinate.X; int newY = item.Coordinate.Y; if (item.ballMover == null && item.ballMover != user) { item.ballMover = user; } while (tryes < 3) { if (_room == null) { if (_room.GetGameMap() == null) { _room.FixGameMap(); } return; } if (item.Direction == Direction.Null) { item.ballIsMoving = false; break; } int resetX = newX; int resetY = newY; ComeDirection.GetNewCoords(item.Direction, ref newX, ref newY); bool trollface = false; if (_room.GetGameMap().SquareHasUsers(newX, newY)) // break 100 %, cannot return the ball { if (item.ExtraData != "55" && item.ExtraData != "44") { item.ballIsMoving = false; break; } trollface = true; } if (trollface == false) { if (!_room.GetGameMap().ItemCanBePlacedHere(newX, newY)) { item.Direction = ComeDirection.InverseDirections(_room, item.Direction, newX, newY); newX = resetX; newY = resetY; tryes++; if (tryes > 2) { item.ballIsMoving = false; } continue; } } if (MoveBall(item, item.ballMover, newX, newY)) { item.ballIsMoving = false; break; } int.TryParse(item.ExtraData, out int Number); if (Number > 11) { item.ExtraData = (int.Parse(item.ExtraData) - 11).ToString(); } item._iBallValue++; if (item._iBallValue > 1) { item.ballIsMoving = false; item._iBallValue = 1; item.ballMover = null; } break; } } // }).Start(); }
internal static ComeDirection GetInverseDirectionEasy(ComeDirection comeWith) { ComeDirection result; try { if (comeWith == ComeDirection.UP) { result = ComeDirection.DOWN; } else { if (comeWith == ComeDirection.UP_RIGHT) { result = ComeDirection.DOWN_LEFT; } else { if (comeWith == ComeDirection.RIGHT) { result = ComeDirection.LEFT; } else { if (comeWith == ComeDirection.DOWN_RIGHT) { result = ComeDirection.UP_LEFT; } else { if (comeWith == ComeDirection.DOWN) { result = ComeDirection.UP; } else { if (comeWith == ComeDirection.DOWN_LEFT) { result = ComeDirection.UP_RIGHT; } else { if (comeWith == ComeDirection.LEFT) { result = ComeDirection.RIGHT; } else { if (comeWith == ComeDirection.UP_LEFT) { result = ComeDirection.DOWN_RIGHT; } else { result = ComeDirection.NULL; } } } } } } } } } catch { result = ComeDirection.NULL; } return(result); }
internal static ComeDirection InverseDirections(Room room, ComeDirection comeWith, int x, int y) { checked { ComeDirection result; try { if (comeWith == ComeDirection.UP) { result = ComeDirection.DOWN; } else { if (comeWith == ComeDirection.UP_RIGHT) { if (room.GetGameMap().StaticModel.SqState[x, y] == SquareState.BLOCKED) { if (room.GetGameMap().StaticModel.SqState[x + 1, y] == SquareState.BLOCKED) { result = ComeDirection.DOWN_RIGHT; } else { result = ComeDirection.UP_LEFT; } } else { result = ComeDirection.DOWN_RIGHT; } } else { if (comeWith == ComeDirection.RIGHT) { result = ComeDirection.LEFT; } else { if (comeWith == ComeDirection.DOWN_RIGHT) { if (room.GetGameMap().StaticModel.SqState[x, y] == SquareState.BLOCKED) { if (room.GetGameMap().StaticModel.SqState[x + 1, y] == SquareState.BLOCKED) { result = ComeDirection.UP_RIGHT; } else { result = ComeDirection.DOWN_LEFT; } } else { result = ComeDirection.UP_RIGHT; } } else { if (comeWith == ComeDirection.DOWN) { result = ComeDirection.UP; } else { if (comeWith == ComeDirection.DOWN_LEFT) { if (room.GetGameMap().Model.MapSizeX - 1 <= x) { result = ComeDirection.DOWN_RIGHT; } else { result = ComeDirection.UP_LEFT; } } else { if (comeWith == ComeDirection.LEFT) { result = ComeDirection.RIGHT; } else { if (comeWith == ComeDirection.UP_LEFT) { if (room.GetGameMap().Model.MapSizeX - 1 <= x) { result = ComeDirection.UP_RIGHT; } else { result = ComeDirection.DOWN_LEFT; } } else { result = ComeDirection.NULL; } } } } } } } } } catch { result = ComeDirection.NULL; } return(result); } }
public async void MoveBallProcess(Item item, bool skip = false) { if (item.ballMover == null || item.ballMover.GetHabbo() == null) { return; } if (item == null) { return; } int newX = item.Coordinate.X; int newY = item.Coordinate.Y; // if comedirection niets is?! if (item.comeDirection == IComeDirection.Null) { item.ballIsMoving = false; return; } if (_room == null) { return; } if (_room.GetRoomUserManager().GetRoomUsers() == null) { return; } List <RoomUser> users = _room.GetRoomUserManager().GetRoomUsers().OrderBy(a => Guid.NewGuid()).ToList(); foreach (RoomUser user in users) { if (user.SetX == newX && user.SetY == newY && user.UserId != item.ballMover.GetHabbo().Id&& item.ExtraData != "44" && item.ExtraData != "33" && user.VirtualId > _room.GetRoomUserManager().GetRoomUserByHabbo(item.ballMover.GetHabbo().Id).VirtualId) { Point userPoint = new Point(user.X, user.Y); item.ExtraData = "55"; item.ballIsMoving = true; item.BallTryGoThrough = 0; item.Shoot = true; item.ballMover = user.GetClient(); MoveBall(item, user.GetClient(), userPoint); return; } } //Set old newX and newY int resetX = newX; int resetY = newY; //Calc other direction ComeDirection.GetNewCoords(item.comeDirection, ref newX, ref newY); bool ignoreUsers = false; if (_room.GetGameMap().SquareHasUsers(newX, newY)) { if (item.ExtraData != "55" && item.ExtraData != "44") { item.ballIsMoving = false; return; } ignoreUsers = true; } if (ignoreUsers == false) { //check if ball can go through if (!_room.GetGameMap().itemCanBePlacedHere(newX, newY)) { //A ball can't go through a wall!!! Set reversed coordinates. item.comeDirection = ComeDirection.InverseDirections(_room, item.comeDirection, newX, newY); newX = resetX; newY = resetY; item.BallTryGoThrough++; //try 2 times if (item.BallTryGoThrough > 2) { item.ballIsMoving = false; item.ExtraData = ("0").ToString(); return; } //try again MoveBallProcess(item, true); return; } } if (item.ballIsMoving) { if (MoveBall(item, item.ballMover, newX, newY)) { int ExtraData = 11; int.TryParse(item.ExtraData, out ExtraData); if (ExtraData > 11) { if (!item.Shoot) { item.ExtraData = (int.Parse(item.ExtraData) - 11).ToString(); } item.Shoot = false; // wait 90 secs await Task.Delay(_room.BallSpeed); MoveBallProcess(item, false); return; } } item.ExtraData = "0"; item.BallTryGoThrough = 0; item.ballIsMoving = false; } }
internal static ComeDirection InverseDirections(Room room, ComeDirection comeWith, int x, int y) { checked { ComeDirection result; try { if (comeWith == ComeDirection.UP) { result = ComeDirection.DOWN; } else { if (comeWith == ComeDirection.UP_RIGHT) { if (room.GetGameMap().StaticModel.SqState[x, y] == SquareState.BLOCKED) { if (room.GetGameMap().StaticModel.SqState[x + 1, y] == SquareState.BLOCKED) { result = ComeDirection.DOWN_RIGHT; } else { result = ComeDirection.UP_LEFT; } } else { result = ComeDirection.DOWN_RIGHT; } } else { if (comeWith == ComeDirection.RIGHT) { result = ComeDirection.LEFT; } else { if (comeWith == ComeDirection.DOWN_RIGHT) { if (room.GetGameMap().StaticModel.SqState[x, y] == SquareState.BLOCKED) { if (room.GetGameMap().StaticModel.SqState[x + 1, y] == SquareState.BLOCKED) { result = ComeDirection.UP_RIGHT; } else { result = ComeDirection.DOWN_LEFT; } } else { result = ComeDirection.UP_RIGHT; } } else { if (comeWith == ComeDirection.DOWN) { result = ComeDirection.UP; } else { if (comeWith == ComeDirection.DOWN_LEFT) { if (room.GetGameMap().Model.MapSizeX - 1 <= x) { result = ComeDirection.DOWN_RIGHT; } else { result = ComeDirection.UP_LEFT; } } else { if (comeWith == ComeDirection.LEFT) { result = ComeDirection.RIGHT; } else { if (comeWith == ComeDirection.UP_LEFT) { if (room.GetGameMap().Model.MapSizeX - 1 <= x) { result = ComeDirection.UP_RIGHT; } else { result = ComeDirection.DOWN_LEFT; } } else { result = ComeDirection.NULL; } } } } } } } } } catch { result = ComeDirection.NULL; } return result; } }
internal static ComeDirection InverseDirections(Room room, ComeDirection comeWith, int x, int y) { try { if (comeWith == ComeDirection.UP) { return(ComeDirection.DOWN); } else if (comeWith == ComeDirection.UP_RIGHT) { if (room.GetGameMap().StaticModel.SqState[x, y] == SquareState.BLOCKED) { if (room.GetGameMap().StaticModel.SqState[x + 1, y] == SquareState.BLOCKED) // x { return(ComeDirection.DOWN_RIGHT); } else { return(ComeDirection.UP_LEFT); } } else { return(ComeDirection.DOWN_RIGHT); } } else if (comeWith == ComeDirection.RIGHT) { return(ComeDirection.LEFT); } else if (comeWith == ComeDirection.DOWN_RIGHT) { if (room.GetGameMap().StaticModel.SqState[x, y] == SquareState.BLOCKED) { if (room.GetGameMap().StaticModel.SqState[x + 1, y] == SquareState.BLOCKED) // x { return(ComeDirection.UP_RIGHT); } else { return(ComeDirection.DOWN_LEFT); } } else { return(ComeDirection.UP_RIGHT); } } else if (comeWith == ComeDirection.DOWN) { return(ComeDirection.UP); } else if (comeWith == ComeDirection.DOWN_LEFT) { if (room.GetGameMap().Model.MapSizeX - 1 <= x) { return(ComeDirection.DOWN_RIGHT); } else { return(ComeDirection.UP_LEFT); } } else if (comeWith == ComeDirection.LEFT) { return(ComeDirection.RIGHT); } else if (comeWith == ComeDirection.UP_LEFT) { if (room.GetGameMap().Model.MapSizeX - 1 <= x) { return(ComeDirection.UP_RIGHT); } else { return(ComeDirection.DOWN_LEFT); } } return(ComeDirection.NULL); } catch { return(ComeDirection.NULL); } }
internal static ComeDirection GetInverseDirectionEasy(ComeDirection comeWith) { ComeDirection result; try { if (comeWith == ComeDirection.UP) { result = ComeDirection.DOWN; } else { if (comeWith == ComeDirection.UP_RIGHT) { result = ComeDirection.DOWN_LEFT; } else { if (comeWith == ComeDirection.RIGHT) { result = ComeDirection.LEFT; } else { if (comeWith == ComeDirection.DOWN_RIGHT) { result = ComeDirection.UP_LEFT; } else { if (comeWith == ComeDirection.DOWN) { result = ComeDirection.UP; } else { if (comeWith == ComeDirection.DOWN_LEFT) { result = ComeDirection.UP_RIGHT; } else { if (comeWith == ComeDirection.LEFT) { result = ComeDirection.RIGHT; } else { if (comeWith == ComeDirection.UP_LEFT) { result = ComeDirection.DOWN_RIGHT; } else { result = ComeDirection.NULL; } } } } } } } } } catch { result = ComeDirection.NULL; } return result; }