public bool moveCoordinates(int inX, int inY, AIStep.MoveEnum step, out int x, out int y) { if (step == AIStep.MoveEnum.UP) { x = inX; y = inY; if (gameBoard.areFieldCoordinatesValid(x, y + 1)) { y++; return(true); } } else if (step == AIStep.MoveEnum.DOWN) { x = inX; y = inY; if (gameBoard.areFieldCoordinatesValid(x, y - 1)) { y--; return(true); } } else if (step == AIStep.MoveEnum.LEFT) { x = inX; y = inY; if (gameBoard.areFieldCoordinatesValid(x - 1, y)) { x--; return(true); } } else if (step == AIStep.MoveEnum.RIGHT) { x = inX; y = inY; if (gameBoard.areFieldCoordinatesValid(x + 1, y)) { x++; return(true); } } x = 0; y = 0; return(false); }
private bool getTargetField(int inX, int inY, AIStep.MoveEnum step, out Field target) { int tx = 0, ty = 0; bool ret = true; target = null; ret = moveCoordinates(inX, inY, step, out tx, out ty); if (ret == false) { return(false); } target = m_gameBoard.getField(tx, ty) as Field; if (target == null) { ret = false; } return(ret); }