コード例 #1
0
        public void placeObject(Block block, Vector2 pos, float deg, bool wasDummy = true)
        {
            if (canPlacePiece(pos, block, deg))
            {
                level.setBlock((int)pos.x, (int)pos.y, block, deg);
                if (!wasDummy)
                {
                    pos = transformToGrid(pos, block.getWidthHeight(deg));
                    grid.placeObject(pos.x, pos.y, block.getBlueprintPrefab(), deg);
                }
                else
                {
                    AudioPlayer("Building");
                    saveToDevice();
                }

                drawRoad();
            }
            else
            {
                level.removeBlock(block);
                block.removeBlueprintPrefab();
                AudioPlayer("error");
            }
            level.storeCompleteStatus();
        }