Exemplo n.º 1
0
    void SetPlayerRPC(PhotonPlayer remotePlayerPP, int remotePlayerID, NationManager.Nation remoteNation,
                      float remoteHP, Tanks remoteTank, bool playerIsOnPlayersList = false)
    {
        //Tworzę gracza i dodaje go do mojej listy graczy
        Player player;

        if (playerIsOnPlayersList)
        {
            player = PlayersManager.FindPlayer(remotePlayerPP);
        }
        else
        {
            player = new Player();
            PlayersManager.GetPlayers().Add(player);
        }

        //Ustawiam podstawowe dane tego gracza
        player.nick      = remotePlayerPP.NickName;
        player.pp        = remotePlayerPP;
        player.nation    = remoteNation;
        player.currentHp = remoteHP;
        player.tank      = remoteTank;

        //Ustawiam odwołanie gracza z listy i właściwego obiektu
        GameObject newPlayerGO = PhotonView.Find(remotePlayerID).gameObject;

        player.gameObject = newPlayerGO;
        newPlayerGO.GetComponent <PlayerGO>().myPlayer = player;

        //Taki bajer
        newPlayerGO.name = "Player_" + player.nick;

        //Ustawiam dane widoczne dla gracza proszącego (ustawiam czołg, sliderHP i nick)
        newPlayerGO.GetComponent <PlayerGO>().myPlayer.currentHp = player.currentHp;
        newPlayerGO.GetComponent <PlayerGO>().myPlayer.nick      = player.nick;
        newPlayerGO.GetComponent <Nick>().nick.text           = player.nick;
        newPlayerGO.GetComponent <PlayerGO>().myPlayer.nation = player.nation;
        newPlayerGO.GetComponent <PlayerGO>().myPlayer.tank   = player.tank;
        newPlayerGO.GetComponent <TankEvolution>().SetStartTankHowNewPlayer(player.tank);
    }
Exemplo n.º 2
0
 public Player()
 {
     nick   = "UnknowPlayer";
     nation = NationManager.Nation.IIIRZESZA;
 }