// Use this for initialization void Start () { // initialize the GUI Controller object gc = GameObject.Find ("GUI Controller").GetComponent<Level_GUIController> (); // initialize the Network Controller object nc = GameObject.Find ("Network Controller").GetComponent<Level_NetworkController> (); classNo=9; }
[RPC] void MovePlayerTeamList(string pName, int newTeam){ nc = GameObject.Find ("Network Controller").GetComponent<Level_NetworkController> (); gc = GameObject.Find ("GUI Controller").GetComponent<Level_GUIController> (); //If we join after other players if (nc.neutPlayers == null) { nc.neutPlayers = new List<PlayerInfo>(); for (int i = 0; i < PhotonNetwork.playerList.Length - 1; i++){ PlayerInfo newPlayer = new PlayerInfo("blank_name"); nc.neutPlayers.Add(newPlayer); } } Debug.Log(pName + " " + newTeam.ToString()); for (int i = 0; i < nc.neutPlayers.Count; i++){ if (nc.neutPlayers[i].name == _MainController.playerName || nc.neutPlayers[i].name == "blank_name"){ PlayerInfo pi = nc.neutPlayers[i]; nc.neutPlayers.Remove(pi); pi.team = (Char_AttributeScript.Teams)newTeam; pi.name = pName; //pi.photonPlayerName = pName; if (pi.team == Char_AttributeScript.Teams.BLUE) nc.bluePlayers.Add(pi); else nc.redPlayers.Add(pi); break; } } gc.SetUpScoreboard(); if (photonView.isMine) photonView.RPC("MovePlayerTeamList", PhotonTargets.OthersBuffered, pName, newTeam); }