示例#1
0
        public void relocate(Client client)
        {
            int x_range = space.width - client.width;
            int y_range = space.height - client.height;

            if (x_range < 0) x_range = 0;
            if (y_range < 0) y_range = 0;

            client.x = x_range == 0 ? 0 : random.Next (x_range);
            client.y = y_range == 0 ? 0 : random.Next (y_range);

            // origin of space
            client.x += space.x;
            client.y += space.y;

            client.move ();
        }