public bool IsHit(Walls walls) { int x = GetNextPoint().x; int y = GetNextPoint().y; int w = walls.GetWidth(); int h = walls.GetHeight(); if (x == 0 || x == w) { return(true); } if (y == 0 || y == h) { return(true); } return(false); }