Beispiel #1
0
    public void OnJoined(IGameClient client, int index, GameData.PlayerData playerData)
    {
        Node startBlock = GameBoard.FindBlockByName(playerData.currentBlockName);

        if (connectionViewController != null)
        {
            connectionViewController.Dismiss();
        }

        if (startBlock)
        {
            PlayerController playerController;
            if (PhotonNetwork.connectedAndReady)
            {
                playerController = PlayerController.createAvatarPlayer(playerData.colorPath, Vector3.zero, Quaternion.identity);
            }
            else
            {
                playerController = PlayerController.CreateLocalPlayer(playerData.colorPath);
            }

            GameBoard.MovePlayerToBlockNode(playerController, startBlock);


            if (players.ContainsKey(index) == false)
            {
                Debug.Log("add player at index: " + index);
                players.Add(index, new PlayerInfo(playerController, playerData));
            }
        }
    }