void PlaceTavernPlayers() { foreach (GameObject playerName in GameObject.FindGameObjectsWithTag("PlayerName")) { playerName.SetActive(false); } int i = 0; foreach (GameObject tvPlayer in GameObject.FindGameObjectsWithTag("Player")) { tvPlayer.transform.SetParent(Seats [i]); Labels [i].gameObject.SetActive(true); if (!PhotonNetwork.offlineMode) { Labels [i].text = npd.Get(tvPlayer.GetPhotonView().owner.name).data ["name"].ToString(); } else { Labels [i].text = pd.data ["name"].ToString(); } tvPlayer.transform.localPosition = Vector3.zero; if (i == 0 || i == 1) { if (tvPlayer.transform.localScale.x > 0) { tvPlayer.transform.localScale = new Vector3(-tvPlayer.transform.localScale.x, tvPlayer.transform.localScale.y, tvPlayer.transform.localScale.z); } } if (i != 3) { IncreaseSortingLayer(tvPlayer.transform); } i++; } }
// Use this for initialization void Start() { GameObject ds = GameObject.Find("PlayersData"); npd = ds.GetComponent <NetworkPlayersData> (); pd = npd.localPd; if (gameObject.GetComponent <PhotonView> ().isMine) { name = pd.data ["name"].ToString(); cls = pd.data ["class"].ToString(); //Item weapon = pd.data["weapon"] as Item; weaponType = pd.CurentWeapon.type; weaponName = pd.CurentWeapon.itName; prefs = pd.CurentWeapon.prefs; weaponSprite = Resources.Load("Sprites/" + pd.CurentWeapon.image, typeof(Sprite)) as Sprite; SpawnWeapon(); } else { PlayersData otherPd = npd.Get(gameObject.GetComponent <PhotonView> ().owner.name); name = otherPd.data ["name"].ToString(); cls = otherPd.data ["class"].ToString(); weaponType = otherPd.CurentWeapon.type; weaponName = otherPd.CurentWeapon.itName; prefs = otherPd.CurentWeapon.prefs; weaponSprite = Resources.Load("Sprites/" + otherPd.CurentWeapon.image, typeof(Sprite)) as Sprite; SpawnWeapon(); } }