Package wolf.city.road.rules

Examples of wolf.city.road.rules.Grid


        //have an intersection! Free, with your purchase!
        Road inters1 = r.rule.globalGoals(city, road, Direction.LEFT);
        Road inters2 = r.rule.globalGoals(city, road, Direction.RIGHT);
        //set the type to street, give it a proper rule
        inters1.setType(RoadType.STREET);
        inters1.rule = new Grid(city);
        inters2.setType(RoadType.STREET);
        inters2.rule = new Grid(city);

        rq.add(inters1);
        rq.add(inters2);
        rqM.add(localConstraints(r));
      }
     
      road = connect(road);
      roads.insert(road.getEnvelope(), road);
      cv.roads.add(road);
     
      if(cv != null){
        cv.draw();
      }
    }
    //generate streets entirely

    //log.log("Streets generating");
    rq.stackStyle = true;
    if(!rq.isEmpty()){
     
      //generate streets
      if(city.random.nextDouble()>.99){
        rq.stackStyle = false;
      }else{
        rq.stackStyle = true;
      }
      Road road = localConstraints(rq.remove());
      if(road != null){
        if(road.finished){
          //finished
        }else{
          if(road.rule instanceof OffRamp){
            road.rule = new Grid(city);
          }
          if(city.random.nextDouble()>.9){ //makes it look like a modern/whatever neighborhood
            road.rule = road.rule.mutate();
          }
          //use grid pattern to fill in areas between highways (Manhattan-esque pattern, but not perfect)
View Full Code Here


  public void setType(RoadType type){
    this.type = type;
    this.width = type.getWidth();
    switch(type){
    case STREET:
      rule = new Grid(rule.getCity());
      break;
    case MAIN:
      rule = new Basic(rule.getCity());
//        public float turnRateForward = 40;
//      };
View Full Code Here

TOP

Related Classes of wolf.city.road.rules.Grid

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.