예제 #1
0
    public void reload_level(int level)
    {
        Debug.Log(level);
        Debug.Log(StatManager.get_state().current_map);
        Debug.Log(StatManager.get_state().bot_level);
        game_terrian.preload_level(StatManager.get_state().current_map);
        game_terrian.instantiate_level(StatManager.get_state().current_map);

        level_param = game_param.level_params[level];

        if (StatManager.get_state().game_mode == 0)
        {
            StatManager.get_state().champion[1] = UnityEngine.Random.Range(1, 4);
        }

        game_state.reload(level_param);
        brick_manager.reload(level_param);
        brick_manager.generate_map(game_terrian.get_grid());

        for (int i = 0; i < 2; i++)
        {
            player_item[i].board.GetComponent <Board>().set_param(level_param);
            player_item[i].board.GetComponent <Board>().player_id = i;
            board_dragged(Vector2.zero, i);
            player_item[i].launcher.GetComponent <Launcher>().set_param(level_param, game_state.player_state[i], i);
        }
        ongame_ui_manager.reload(game_state);
        if (bot_manager != null)
        {
            bot_manager.reload(level_param, StatManager.get_state().bot_level);
        }
        if (bot_manager2 != null)
        {
            bot_manager2.reload(level_param, 2);
        }

        is_paused        = false;
        is_finished      = false;
        time_begin       = Time.time;
        checkpoint_state = 0;
    }