Example #1
0
    // Use this for initialization
    void Start()
    {
        DontDestroyOnLoad(gameObject);

        //Player has joined. Tell the lobbyManager so that it can spawn a lobby entity for the player.
        lobbyManager = GameObject.Find("GameLobby").GetComponent <GameLobbyManager>();
        lobbyManager.PlayerConnected(this, isLocalPlayer, isServer); //Behaviour changes for local players own lobby entity.

        PlayerID = playerID++;

        if (isHost) //To identify host in Hierachy, this conditional is only fired for clients, isHost is false for the host itself until later.
        {
            name = "HostPlayer";
        }
        if (!isLocalPlayer)
        {
            return;
        }
        if (isServer) // player object becomes TurnController for everyone;
        {
            Cmd_SetHost();
            Cmd_SpawnTurnController();
        }
    }