Exemplo n.º 1
0
    void PlayerJoin()
    {
        PlayerSpawnPoint psp     = GameObject.FindObjectOfType <PlayerSpawnPoint>();
        Vector3          bornPos = psp.GetSpawnPoint();

        bornPos.y = 1.58f;

        string data = string.Format(
            "{0}|{1}|{2}|{3},{4},{5}|0,0,0|1,1,1",
            myPlayerId,
            playerNameDefault[Random.Range(0, playerNameDefault.Length - 1)],
            playerInitHp,
            bornPos.x, bornPos.y, bornPos.z
            );

        connectionAgent.SendCmd(Cmd.player_join, data);
    }
Exemplo n.º 2
0
    IEnumerator JoinTheGame()
    {
        yield return(new WaitForEndOfFrame());

        PlayerSpawnPoint psp     = GameObject.FindObjectOfType <PlayerSpawnPoint>();
        Vector3          bornPos = psp.GetSpawnPoint();

        string data = string.Format(
            "{0}|{1}|{2}|{3},{4},{5}|0,0,0|1,1,1",
            mySocketId, // 用mySocketId當作playerId
            playerNameDefault[Random.Range(0, playerNameDefault.Length - 1)],
            playerInitHp,
            bornPos.x, bornPos.y, bornPos.z
            );

        connectionAgent.SendCmd(Cmd.player_join, data);
    }