private void initializeTurn() { state = State.Continue; turn++; energy++; ammo++; clearBoard(); for (int i = Math.min(turn * 5, MAX_DALEKS); i > 0; i--) { for (;;) { int x = (int)(Math.random() * WIDTH); int y = (int)(Math.random() * HEIGHT); if (board[x][y] != null) { continue; } board[x][y] = new Dalek { X = x, Y = y }; break; } } for (;;) { whoX = (int)(Math.random() * WIDTH); whoY = (int)(Math.random() * HEIGHT); if (board[whoX][whoY] == null) { break; } } updateStatus(); }
public static Boolean testLaserAttack(BoundingBox doctor, Dalek baddy) { bool hit = false; foreach (LaserBeam deathRay in baddy.DalekLove) { hit = deathRay.Bbox.Intersects(doctor); } return(hit); }