Example #1
0
    public void SetRoofTileID(int subGridIndex, int gridX, int gridY, int roofID)
    {
        GridIDs gridIDs = GetGridIDs(subGridIndex);

        if (!gridIDs.isNull)
        {
            try
            {
                gridIDs.roofTileIDs[gridX, gridY] = roofID;
            }
            catch (IndexOutOfRangeException)
            {
                ComponentSubGrid subGrid = grid.GetSubGrid(subGridIndex);
                if (subGrid != null)
                {
                    gridIDs.roofTileIDs = new int[subGrid.gridSizeX, subGrid.gridSizeY];
                }
            }
        }
        else
        {
            ComponentSubGrid subGrid = grid.GetSubGrid(subGridIndex);
            if (subGrid != null)
            {
                GridIDs newGridIDs = new GridIDs(subGrid.gridSizeX, subGrid.gridSizeY, subGridIndex);
                gridTileIDs.Add(newGridIDs);
                newGridIDs.roofTileIDs[gridX, gridY] = roofID;
            }
        }
    }
Example #2
0
    public ProcessingComponent_s MakeSerializable()
    {
        List <Grid_s> serializableGrids = new List <Grid_s>();

        foreach (ComponentSubGrid grid in grid.grids)
        {
            GridIDs gridIDs   = GetGridIDs(grid.subGridIndex);
            Grid_s  newGrid_s = new Grid_s(grid.transform.position, grid, gridIDs.gridTileIDs, gridIDs.intWallTileIDs, gridIDs.extWallTileIDs, gridIDs.roofTileIDs);
            serializableGrids.Add(newGrid_s);
        }
        List <WindowSection_s> serializableWindows = new List <WindowSection_s>();

        foreach (WindowSection windowSection in windows)
        {
            List <Window_s> windows_s = new List <Window_s>();
            foreach (Window window in windowSection.windows)
            {
                windows_s.Add(new Window_s(window.gridIndex, window.transform.eulerAngles.y));
            }
            WindowSection_s newWindowSection_s = new WindowSection_s(windowSection.grid.subGridIndex, windowSection.windowID, windowSection.subID, windows_s);
        }
        List <StoreObject_s> serializableStoreObjects = new List <StoreObject_s>();

        foreach (StoreObject storeObject in storeObjects)
        {
            serializableStoreObjects.Add(storeObject.MakeSerializable());
        }
        ProcessingComponent_s toReturn = new ProcessingComponent_s(index, gameObject.transform.position, gameObject.transform.eulerAngles.y, serializableGrids, serializableWindows, serializableStoreObjects);

        return(toReturn);
    }
    public MainStoreComponent_s MakeSerializable()
    {
        List <Grid_s> serializableGrids = new List <Grid_s>();

        foreach (ComponentSubGrid grid in grid.grids)
        {
            GridIDs gridIDs   = GetGridIDs(grid.subGridIndex);
            Grid_s  newGrid_s = new Grid_s(grid.transform.position, grid, gridIDs.gridTileIDs, gridIDs.intWallTileIDs, gridIDs.extWallTileIDs, gridIDs.roofTileIDs);
            serializableGrids.Add(newGrid_s);
        }
        List <WindowSection_s> serializableWindows = new List <WindowSection_s>();

        foreach (WindowSection windowSection in windows)
        {
            List <Window_s> windows_s = new List <Window_s>();
            foreach (Window window in windowSection.windows)
            {
                windows_s.Add(new Window_s(window.gridIndex, window.transform.eulerAngles.y));
            }
            WindowSection_s newWindowSection_s = new WindowSection_s(windowSection.grid.subGridIndex, windowSection.windowID, windowSection.subID, windows_s);
            serializableWindows.Add(newWindowSection_s);
        }
        List <StoreObject_s> storeObjects_s = new List <StoreObject_s> ();

        foreach (StoreObject storeObject in storeObjects)
        {
            storeObjects_s.Add(storeObject.MakeSerializable());
        }

        /*foreach (DisplayShelf shelf in GetDisplayShelves())
         * {
         *  storeObjects_s.Add(shelf.MakeSerializable());
         * }
         * foreach (CheckoutCounter checkoutCounter in GetCheckoutCounters())
         * {
         *  storeObjects_s.Add(checkoutCounter.MakeSerializable());
         * }
         * foreach (BudtenderCounter budtenderCounter in GetBudtenderCounters())
         * {
         *  storeObjects_s.Add(budtenderCounter.MakeSerializable());
         * }*/
        MainStoreComponent_s toReturn = new MainStoreComponent_s(gameObject.transform.position, gameObject.transform.eulerAngles.y, serializableGrids, serializableWindows, storeObjects_s);

        return(toReturn);
    }