예제 #1
0
 private void makeflavor() {
   @SuppressWarnings("unchecked")
   Collection<Gob>[] fo = (Collection<Gob>[]) new Collection[cutn.x * cutn.y];
   for (int i = 0; i < fo.length; i++) fo[i] = new LinkedList<Gob>();
   Coord c = new Coord(0, 0);
   Coord tc = gc.mul(cmaps);
   int i = 0;
   Random rnd = new Random(id);
   for (c.y = 0; c.y < cmaps.x; c.y++) {
     for (c.x = 0; c.x < cmaps.y; c.x++, i++) {
       Tileset set = tileset(tiles[i]);
       if (set.flavobjs.size() > 0) {
         if (rnd.nextInt(set.flavprob) == 0) {
           Resource r = set.flavobjs.pick(rnd);
           double a = rnd.nextDouble() * 2 * Math.PI;
           Gob g = new Flavobj(c.add(tc).mul(tilesz).add(tilesz.div(2)), a);
           g.setattr(new ResDrawable(g, r));
           Coord cc = c.div(cutsz);
           fo[cc.x + (cc.y * cutn.x)].add(g);
         }
       }
     }
   }
   this.fo = fo;
 }
예제 #2
0
 public Random mkrandoom() {
   Random r = new Random(Grid.this.id);
   r.setSeed(r.nextInt() ^ rc.x);
   r.setSeed(r.nextInt() ^ rc.y);
   return (r);
 }