Beispiel #1
0
 public void Start()
 {
     foreach (Renderer r in GetComponentsInChildren <Renderer>())
     {
         r.material.color = AsteroidsGame.GetColor(photonView.Owner.GetPlayerNumber());
     }
 }
        public void Start()
        {
            foreach (var r in GetComponentsInChildren <Renderer>())
            {
                r.material.color = AsteroidsGame.GetColor(photonView.Owner.GetPlayerNumber());
            }

            transform.GetChild(0).gameObject.SetActive(photonView.IsMine);
        }
Beispiel #3
0
 private void OnPlayerNumberingChanged()
 {
     foreach (Player p in PhotonNetwork.PlayerList)
     {
         if (p.ActorNumber == ownerId)
         {
             PlayerColorImage.color = AsteroidsGame.GetColor(p.GetPlayerNumber());
         }
     }
 }
 private void OnPlayerNumberingChanged()
 {
     foreach (Player p in PhotonNetwork.PlayerList)
     {
         if (p.ActorNumber == ownerId)
         {
             //print(p.GetPlayerNumber());
             PlayerColorImage.sprite = PlayerFlag[AsteroidsGame.GetColor(p.GetPlayerNumber())];
         }
     }
 }
        public void Awake()
        {
            playerListEntries = new Dictionary <int, UnityEngine.GameObject>();

            foreach (Player p in PhotonNetwork.PlayerList)
            {
                UnityEngine.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}\nLives: {2}", p.NickName, p.GetScore(), AsteroidsGame.PLAYER_MAX_LIVES);

                playerListEntries.Add(p.ActorNumber, entry);
            }
        }
        float oneTurnTime = 60.0f;         // set time limit in one turn
        #region UNITY
        public void Awake()
        {
            playerListEntries = new Dictionary <int, GameObject>();
            // player A's nickname and work progress
            Player_A_n.GetComponent <Text>().color = AsteroidsGame.GetColor(PhotonNetwork.PlayerList[0].GetPlayerNumber());
            Player_A_n.GetComponent <Text>().text  = string.Format("{0}\nProgress : {1}", PhotonNetwork.PlayerList[0].NickName, PhotonNetwork.PlayerList[0].GetProgress());
            playerListEntries.Add(PhotonNetwork.PlayerList[0].ActorNumber, Player_A_n);

            // player B
            Player_B_n.GetComponent <Text>().color = AsteroidsGame.GetColor(PhotonNetwork.PlayerList[1].GetPlayerNumber());
            Player_B_n.GetComponent <Text>().text  = string.Format("{0}\nProgress : {1}", PhotonNetwork.PlayerList[1].NickName, PhotonNetwork.PlayerList[1].GetProgress());
            playerListEntries.Add(PhotonNetwork.PlayerList[1].ActorNumber, Player_B_n);

            // host player get first turn
            PhotonNetwork.PlayerList[0].SetTurn(true);
            PhotonNetwork.PlayerList[1].SetTurn(false);

            if (PhotonNetwork.LocalPlayer.ActorNumber == 1)             // active host player's object
            {
                TurnEndActor1.SetActive(true);
                ActorAction1.SetActive(true);
                ActorUpgrade1.SetActive(true);
                ActorDistract1.SetActive(true);
                StressGauge1.SetActive(true);
                GoodGauge1.SetActive(true);
                EvilGauge1.SetActive(true);
                PRGauge1.SetActive(true);
                for (int i = 0; i < 4; i++)
                {
                    StatusInfo[i].SetActive(true);
                }
            }
            else             // other player
            {
                TurnEndActor2.SetActive(true);
                ActorAction2.SetActive(true);
                ActorUpgrade2.SetActive(true);
                ActorDistract2.SetActive(true);
                StressGauge2.SetActive(true);
                GoodGauge2.SetActive(true);
                EvilGauge2.SetActive(true);
                PRGauge2.SetActive(true);
                for (int i = 4; i < 8; i++)
                {
                    StatusInfo[i].SetActive(true);
                }
            }
        }