Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        float verticalSize   = Camera.main.orthographicSize * 2.0f;
        float horizontalSize = verticalSize * Screen.width / Screen.height;

        startPoint.x = -horizontalSize / 2;
        startPoint.y = -verticalSize / 2;

        blockSize.x = horizontalSize / (sizeX - 1);
        blockSize.y = verticalSize / (sizeY - 1);

        buildingSize = blockSize * 0.6f;

        generator = new CityGenerator (sizeX - 2, sizeY - 2);

        for (int i = 0; i < 500; i++)
            generator.GlueBuildings ();

        //var building = new CityBuilding (5,5);
        //building.points.Add (new Point(0,-1));
        //building.points.Add (new Point(0,1));
        //building.points.Add (new Point(-1,0));
        //building.points.Add (new Point(1,0));
        //AddBuilding(building);

        for (int x = 0; x < sizeX -2 ; x++) {
            for(int y = 0; y < sizeX - 2; y++){
                CityBuilding building = generator.Grid[x,y];

                if( building.X == x && building.Y == y){
                    AddBuilding(building);
                }
            }
        }
    }