// Use this for initialization void Start() { title = GameObject.Find("ActiveChats"); EmojiBtn = GameObject.Find("EmojiBtn").GetComponent <Button>(); ExitBtn = GameObject.Find("ExitBtn").GetComponent <Button>(); mfieldOfView = 60.0f; sceneCamera = Camera.main; playerCamera = gameObject.GetComponentInChildren <Camera>(); networkmgn = new networkManager(); }
void ajoutTeam(int senderID) { networkManager netMan = (networkManager)GameObject.Find("multiScripts").GetComponent("networkManager"); PhotonPlayer target = PhotonPlayer.Find(senderID); scoreScript scoreMan = GetComponent <scoreScript>(); if (blueCount <= redCount) { //photonView.RPC("blueTeam", target, null ); photonView.RPC("setTeam", target, "Blue"); blueCount++; scoreMan.blueCount++; } else { //photonView.RPC("redTeam", target, null ); photonView.RPC("setTeam", target, "Red"); redCount++; scoreMan.redCount++; } }
public void Awake() { m_NetworkManager = GameObject.FindObjectOfType <networkManager>(); }
/*########### # START # ###########*/ // Use this for initialization void Start() { //On récupère l'ID du joueur PhotonView photonView = PhotonView.Get(this); int myID = photonView.owner.ID; //We activate the scoreScript scoreScript scoreEn = GetComponent <scoreScript>(); if (photonView.isMine) { scoreEn.enabled = true; } else { scoreEn.enabled = false; } //On change le nom du joueur PhotonNetwork.playerName = PlayerPrefs.GetString("Gamertag"); /*--------------------------------------------------------BUG WITH THE PLAYER NAME, PUT BACK TO NORMAL, JUST FOR TEST -----------------------------*/ /*int playerNumb = Random.Range(0, 10000); * PhotonNetwork.playerName = "player" + playerNumb.ToString();*/ networkManager netMan = (networkManager)GameObject.Find("multiScripts").GetComponent("networkManager"); /*----- IN MATCH -----*/ blueSpawn = GameObject.Find("spawn_Blue"); spawnBlue1 = blueSpawn.transform.Find("spawnBlue1").gameObject; spawnBlue2 = blueSpawn.transform.Find("spawnBlue2").gameObject; playerCountUpdateTimer = 0f; //We change the team of the player if (PhotonNetwork.isMasterClient) { blueCount = 0; redCount = 0; scoreScript scoreMan = GetComponent <scoreScript>(); if (blueCount <= redCount) { actualTeam = "Blue"; blueCount++; scoreMan.myTeam = "Blue"; } else { actualTeam = "Red"; redCount++; scoreMan.myTeam = "Red"; } } else { this.photonView.RPC("ajoutTeam", PhotonTargets.MasterClient, myID); } }
void Awake() { _instance = this; }