public void PopulatePiecesInfo()
 {
     pieces = new Dictionary <Coord, BuildingCell>();
     foreach (Transform cellGO in content.DisposableRoot)
     {
         BuildingCell cell = cellGO.GetComponent <BuildingCell>();
         pieces[Coord.FromWorld(cell.transform.localPosition,
                                FloorTile.tileSize)] = cell;
     }
 }
        public MatrixBuildingState GetState()
        {
            MatrixBuildingState state = new MatrixBuildingState();

            foreach (Transform cellGO in content.DisposableRoot)
            {
                BuildingCell cell = cellGO.GetComponent <BuildingCell>();
                state.cells.Add(cell.GetState());
            }

            return(state);
        }
        public void Add(Coord pos)
        {
            BuildingCell created = Util.Instantiate(prototype).AddComponent <BuildingCell>();

            created.name = pos.ToString();
            created.Initialize();
            pieces[pos]                     = created;
            created.tile                    = created.GetComponent <BuildingTile>();
            created.transform.parent        = content.DisposableRoot;
            created.transform.localRotation = Quaternion.identity;
            created.transform.localPosition = pos.ToWorld();
        }