Exemple #1
0
    private void CreateSpecialTile(DS1.Cell cell, int x, int y, Transform parent)
    {
        // debug visualization
        DT1.Tile tile;
        if (specialTiles.Sample(cell.tileIndex, out tile))
        {
            var renderer = CreateTile(tile, x, y, parent: parent);
            renderer.gameObject.layer = UnityLayers.SpecialTiles;
        }

        if (info == null)
        {
            return;
        }

        if (cell.mainIndex < 8)
        {
            int targetLevelId = info.vis[cell.mainIndex];
            int warpId        = info.warp[cell.mainIndex];
            var targetLevel   = LevelInfo.Find(targetLevelId);
            var levelWarpInfo = LevelWarpInfo.Find(warpId);
            if (levelWarpInfo == null)
            {
                Debug.LogWarning("Warp info wasn't found");
                return;
            }
            Warp.Create(x, y, levelWarpInfo, info, targetLevel, parent);
        }
    }
Exemple #2
0
        private void CreateSpecialTile(DS1.Cell cell, int x, int y, Transform parent)
        {
            // debug visualization
            if (specialTiles.Sample(cell.tileIndex, out var tile))
            {
                WorldState.instance.Grid.PutSpecialTile(tile, x, y);
            }

            if (info == null)
            {
                return;
            }

            if (cell.mainIndex < 8)
            {
                int targetLevelId = info.vis[cell.mainIndex];
                int warpId        = info.warp[cell.mainIndex];
                var targetLevel   = LevelInfo.Find(targetLevelId);
                var levelWarpInfo = LevelWarpInfo.Find(warpId);
                if (levelWarpInfo == null)
                {
                    Debug.LogWarning("Warp info wasn't found");
                    return;
                }
                Warp.Create(x, y, levelWarpInfo, info, targetLevel, parent);
            }
        }
Exemple #3
0
    private void FillGap(Vector2i offset, int x, int y, Transform root)
    {
        int offsetX = x * gridX;
        int offsetY = y * gridY;

        for (y = offsetY; y < offsetY + gridY; ++y)
        {
            for (x = offsetX; x < offsetX + gridX; ++x)
            {
                DT1.Tile tile;
                tileSampler.Sample(0, out tile);
                CreateTile(tile, offset.x + x, offset.y + y, parent: root);
            }
        }
    }
Exemple #4
0
        private void FillGap(Vector2i offset, int x, int y, Transform root)
        {
            UnityEngine.Profiling.Profiler.BeginSample("LevelBuilder.FillGap");
            int offsetX = x * gridX;
            int offsetY = y * gridY;

            for (y = offsetY; y < offsetY + gridY; ++y)
            {
                for (x = offsetX; x < offsetX + gridX; ++x)
                {
                    DT1.Tile tile;
                    tileSampler.Sample(0, out tile);
                    CreateTile(tile, offset.x + x, offset.y + y, parent: root);
                }
            }
            UnityEngine.Profiling.Profiler.EndSample();
        }
Exemple #5
0
        private void FillGap(Vector2i offset, int x, int y, Transform root)
        {
            Profiler.BeginSample("LevelBuilder.FillGap");
            int offsetX = x * gridX;
            int offsetY = y * gridY;

            for (y = offsetY; y < offsetY + gridY; ++y)
            {
                for (x = offsetX; x < offsetX + gridX; ++x)
                {
                    if (tileSampler.Sample(0, out var tile))
                    {
                        WorldState.instance.Grid.PutFloor(tile, offset.x + x, offset.y + y, 0);
                    }
                }
            }
            Profiler.EndSample();
        }