private void SpawnPlayer(VirtualInput vi, int controllerId)
    {
        Vector3 spawnPoint = spawnPoints.GetRandomUnusedSpawnPoint();
        Player  player     = Instantiate(playerPrefab, spawnPoint, Quaternion.identity);

        //player.playerColor = Random.ColorHSV(0f, 1f);
        //player.SetColor(Random.ColorHSV(0f, 1f));
        player.ControllerID = controllerId;
        playerSpawner.SetUpPlayerColor(player, player.ControllerID);
        player.SetVirtualInput(vi);
        player.transform.GetChild(2).GetComponent <Canvas>().worldCamera = Camera.main;
        player.GetComponent <PlayerController>().scoreManager            = scoreManager;
    }
Exemple #2
0
    private IEnumerator ResetRound()
    {
        yield return(new WaitForFixedUpdate());

        // Apply mostKills in a round
        foreach (RecordStat mostKills in confirmedKills)
        {
            mostKills.Player.StatTracker.AddStat(mostKills);
        }
        confirmedKills.Clear();

        spawnPoints.ResetSpawnPoints();
        // TODO: Fix setting players active/setting position
        foreach (Player player in allPlayers)
        {
            player.transform.position = spawnPoints.GetRandomUnusedSpawnPoint();
            player.gameObject.SetActive(true);
        }

        yield return(null);
    }