private void OnPlayerNumberingChanged()
 {
     foreach (Photon.Realtime.Player p in PhotonNetwork.PlayerList)
     {
         if (p.ActorNumber == ownerId)
         {
             PlayerColorImage.color = AsteroidsGame.GetColor(p.GetPlayerNumber());
         }
     }
 }
Exemple #2
0
        public void Awake()
        {
            photonView = GetComponent <PhotonView>();

            rigidbody = GetComponent <Rigidbody>();

            if (photonView.IsMine)
            {
                camFollow        = Camera.main.GetComponent <FollowTarget>();
                camFollow.target = transform;
            }

            Username.text  = photonView.Owner.NickName;
            Username.color = AsteroidsGame.GetColor(photonView.Owner.GetPlayerNumber());
        }
        public void Awake()
        {
            playerListEntries = new Dictionary <int, GameObject>();

            foreach (Photon.Realtime.Player p in PhotonNetwork.PlayerList)
            {
                GameObject entry = Instantiate(PlayerOverviewEntryPrefab);
                entry.transform.SetParent(gameObject.transform);
                entry.transform.localScale        = Vector3.one;
                entry.GetComponent <Text>().color = AsteroidsGame.GetColor(p.GetPlayerNumber());
                entry.GetComponent <Text>().text  = string.Format("{0}\nScore: {1}\n", p.NickName, p.GetScore());

                playerListEntries.Add(p.ActorNumber, entry);
            }
        }
Exemple #4
0
        private void FindWinner()
        {
            string winner = "";
            int    score  = -1;
            Color  color  = Color.black;

            foreach (Photon.Realtime.Player p in PhotonNetwork.PlayerList)
            {
                if (p.GetScore() > score)
                {
                    winner = p.NickName;
                    score  = p.GetScore();
                    color  = AsteroidsGame.GetColor(p.GetPlayerNumber());
                }
            }

            StartCoroutine(EndOfGame(winner, score, color));
            StorePersonalBest();
        }