示例#1
0
    private void RemovePlayer(PlayerController player)
    {
        PlayerZone lobbyZone = GameManager.Instance.lobbyManager.playersZones[player.playerId];

        lobbyZone.Enable(null);

        takenPlayerIds[player.playerId]   = false;
        takenPlayerColors[player.colorId] = false;
        Destroy(player.gameObject);
        players.Remove(player);

        GameManager.Instance.currentPlayerCount--;
    }
示例#2
0
    private void CreateNewPlayer(InputDevice device)
    {
        int id      = GetPlayerId();
        int colorId = GetPlayerColorId(id);

        PlayerZone       lobbyZone = GameManager.Instance.lobbyManager.playersZones[id];
        GameObject       go        = Instantiate(playerPrefab, lobbyZone.spawnPos, Quaternion.Euler(90, 0, 0), transform);
        PlayerController pc        = go.GetComponent <PlayerController>();

        pc.device     = device;
        pc.deviceMeta = device.Meta;
        pc.SetName("player" + id, id, colorId);
        pc.SetColor(colorId);
        lobbyZone.Enable(pc);

        players.Add(pc);

        GameManager.Instance.currentPlayerCount++;
    }