public void PlayerJoined(int id, string name, Vector3 position, Color color, int score, PlayerInfo.PlayerState playerstate)
    {
        Debug.Log("Player " + id + " just joined the game");
        RegisterNewPlayer(id, name);
        PlayerInfo newPlayer = SetPlayerInfo(id, name, position, color, score, playerstate);

        SpawnPlayer(newPlayer);
    }
    public PlayerInfo SetPlayerInfo(int id, string playerName, Vector3 position, Color color, int score, PlayerInfo.PlayerState playerstate)
    {
        if (!players.ContainsKey(id))
        {
            RegisterNewPlayer(id, playerName);
        }
        PlayerInfo player = players[id];

        player.Name         = playerName;
        player.Position     = position;
        player.Color        = color;
        player.Score        = score;
        player.currentState = playerstate;
        return(player);
    }
 private void SetPlayerInfo(string playerName, Vector3 position, int score, int playerState, PhotonMessageInfo messageInfo)
 {
     Debug.Log("GotPlayerInfo:" + playerName);
     PlayerInfo.PlayerState state = (PlayerInfo.PlayerState)playerState;
     gameStateManager.SetPlayerInfo(messageInfo.sender.ID, playerName, position, Color.green, score, state);
 }