Example #1
0
    //|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|//|\\|
    void Build( BuildingJsonReadyObject data )
    {
        Clear();

        int x;
        int y;
        int i = 0;
        BuilderGridTile t;

        for( y = 0 ; y < mapSize.y ; y++ ) {

            for( x = 0 ; x < mapSize.x ; x++ ) {

                t = (BuilderGridTile)Instantiate( prefabTile );
                t.Init( x, y );
                t.onClick += OnTileClick;
                t.onOver += OnTileMouseOver;
                t.onOut += OnTileMouseOut;

                tiles.Add( t );
                SetFloor( t, data.floors[i] );

                i++;

            }

        }

        foreach( BuildingObjectRecord obj in data.objects ) {

            AddShit( GetTile(obj.x, obj.y), obj.c, obj.i );

        }
    }
Example #2
0
 public static BuildingJsonReadyObject BuildingJsonReadyObject( List<BuildingObjectRecord> objects, Dictionary<BuilderGridTile, int> floors )
 {
     BuildingJsonReadyObject o = new BuildingJsonReadyObject
                                     {
                                         objects = objects.ToArray() ,
                                         floors = floors.Values.ToArray()
                                     };
     return o;
 }