Exemple #1
0
    void TileManagerTools()
    {
        if (Grid == null)
        {
            return;
        }

        if (Selection.activeGameObject != null &&
            Selection.activeGameObject != Grid.gameObject &&
            Selection.activeGameObject.GetComponent <TileManager>() != null &&
            GUILayout.Button("Append Grid Test", GUILayout.Width(100))
            )
        {
            Grid.AppendGrid(Selection.activeGameObject.GetComponent <TileManager>());
        }


        if (GUILayout.Button("Spawn Random Region"))
        {
            //  WorldExtender.SpawnRegion(  RegionLoader.GetWeightedRegionForLevel(0, new List<RegionConfig>()), Grid);

            if (CurrentTileSelection != null)
            {
                CurrentTileSelection.Clear();
            }
        }

        if (GUILayout.Button("Spawn Next Region"))
        {
            WorldExtender.Instance.SpawnNext();

            if (CurrentTileSelection != null)
            {
                CurrentTileSelection.Clear();
            }
        }

        if (GUILayout.Button("Spawn Camp Region"))
        {
            // WorldExtender.SpawnRegion(RegionLoader.GetCamp(0), Grid);

            if (CurrentTileSelection != null)
            {
                CurrentTileSelection.Clear();
            }
        }

        if (GUILayout.Button("Select All"))
        {
            CurrentTileSelection.Clear();
            CurrentTileSelection.AddRange(Grid.GetTileList());
            SelectCurrentTilesInEditor();
        }
        if (GUILayout.Button("Select Border"))
        {
            List <Tile> border = TileManager.GetBorderTiles(CurrentTileSelection, Grid, true);
            CurrentTileSelection.Clear();
            CurrentTileSelection.AddRange(border);
            SelectCurrentTilesInEditor();
        }


        if (GUILayout.Button("Show Current Crumble Weights"))
        {
            if (weighted == null)
            {
                weighted = TileWeighted.GetWeightedTiles(Grid);
            }
            else
            {
                weighted = null;
            }
            SceneView.RepaintAll();
        }

        if (GUILayout.Button("Reset Tile Visual States"))
        {
            foreach (Tile t in Grid.FetchTiles())
            {
                t.SetBaseState();
            }
        }

        if (Application.isPlaying && GUILayout.Button("Test Crumble"))
        {
            TileWeighted.GetCrumbleTiles(20, Grid).ForEach(t => t.StartCrumble());

            //  MDebug.Log(Grid.GetLastActiveRow());

            Grid.GetTileList().ForEach(t => t.OnCrumbleTurn(0));
            SceneView.RepaintAll();
        }

        if (GUILayout.Button("Spawn Meshes"))
        {
            List <Tile> tiles = Grid.GetTileList();
            foreach (Tile t in tiles)
            {
                TileEditor.SpawnMesh(t);
            }
            SceneView.RepaintAll();
        }

        if (GUILayout.Button("Bake"))
        {
            BakeGrid.Bake(Grid);
            SceneView.RepaintAll();
        }
    }