Beispiel #1
0
    void StartNewRound()
    {
        currentRound++;
        currentLevelIndex++;

        if (!randomLevelOrder)
        {
            currentLevelIndex = MapSystem.Play_Map(tilemapGround, tilemapWall, tilemapObjects, tilemapTop, currentLevelIndex, tile_prefab_array, ground_tiles_array, wall_tiles_array, objects_tiles_array, top_tiles_array);
        }
        else
        {
            currentLevelIndex = MapSystem.Play_Map(tilemapGround, tilemapWall, tilemapObjects, tilemapTop, -1, tile_prefab_array, ground_tiles_array, wall_tiles_array, objects_tiles_array, top_tiles_array);
        }

        if (currentLevelIndex == -1)
        {
            Debug.Log("Couldn't find a map to load. (2)");
            SceneManager.LoadScene("MenuScene");
        }

        centerCamera();

        spawnPlayers();

        countdownUI.SetActive(true);
    }
Beispiel #2
0
    // Start is called before the first frame update
    void Start()
    {
        countdownUI.SetActive(true);

        SaveSystem.Init();

        // Get player controller bindings
        GameObject PCBinding = GameObject.Find("PCBinding");
        ControllerPlayerBinding cpBinding = PCBinding.GetComponent <ControllerPlayerBinding>();

        //player_info = cpBinding.getPlayerInfo();

        /* Possibly use constructor (maybe not a good idea) http://ilkinulas.github.io/development/unity/2016/05/30/monobehaviour-constructor.html
         * for (int i = 0; i < 0; i++)
         * {
         *  if (player_info[i, 0] != 0)
         *  {
         *      player = new PlayerController(player_info[i, 0], player_info[i, 1], player_info[i, 2]);
         *  }
         * }*/

        // Used to load specific map

        /*
         * if (cpBinding.getLevelPath() != null) MapSystem.Play_Selected_Map(tilemapGround, tilemapWall, tilemapObjects, tilemapTop, cpBinding.getLevelPath(), tile_prefab_array, ground_tiles_array, wall_tiles_array, objects_tiles_array, top_tiles_array);
         * else SceneManager.LoadScene("MenuScene");
         */
        currentLevelIndex = MapSystem.Play_Map(tilemapGround, tilemapWall, tilemapObjects, tilemapTop, -1, tile_prefab_array, ground_tiles_array, wall_tiles_array, objects_tiles_array, top_tiles_array);
        if (currentLevelIndex == -1)
        {
            Debug.Log("Couldn't find a map to load. (2)");
            SceneManager.LoadScene("MenuScene");
        }

        spawnPlayersFromLobby(cpBinding);

        centerCamera();
    }