예제 #1
0
        private void InitializeGame()
        {
            //Initilaize team information and instantiate the local player.
            myTeam = (ETeam)PhotonNetwork.player.CustomProperties[TeamKey];

            //Set UI Informations and deactive the interactive UI before game start).
            uiManager.SetTeamLabel(myTeam);
            uiManager.SetSkillButtons(myTeam);
            uiManager.RenewThievesNum(thievesNum);
            uiManager.DeactivateUIGroup();

            detectivePlayers = new List <PhotonPlayer>();
            thiefPlayers     = new List <PhotonPlayer>();
            foreach (PhotonPlayer player in PhotonNetwork.playerList)
            {
                ETeam teamOfPlayer = (ETeam)player.CustomProperties[TeamKey];
                if (teamOfPlayer == ETeam.Detective)
                {
                    detectivePlayers.Add(player);
                }
                else if (teamOfPlayer == ETeam.Thief)
                {
                    thiefPlayers.Add(player);
                }
            }

            // Set master client priority
            masterPriority = new List <int>();
            foreach (PhotonPlayer thiefPlayer in thiefPlayers)
            {
                masterPriority.Add(thiefPlayer.ID);
            }
            masterPriority.Sort();

            List <int> detectivePriority = new List <int>();

            foreach (PhotonPlayer detectivePlayer in thiefPlayers)
            {
                detectivePriority.Add(detectivePlayer.ID);
            }
            detectivePriority.Sort();

            masterPriority.AddRange(detectivePriority);

            // Initilize other local conditions
            ItemController.ResetItemList();
            PutItemPoint.ResetActivatedPointList();
            DetectiveController.ResetPlayerInstances();

            // Game initiation by the master client.
            if (PhotonNetwork.isMasterClient)
            {
                // Set generation points of players and generate scene objects.
                SetGenPointAndGenSceneObj();
            }
        }
예제 #2
0
        private void Awake()
        {
            playerInstances.Add(GetComponent <PlayerController>());

            if (!photonView.isMine)
            {
                return;
            }

            if (localDetective != null)
            {
                Debug.LogError("Multiple instantiation of local detective.");
                PhotonExtends.Destroy(gameObject);
                return;
            }

            localDetective = this;
        }
예제 #3
0
 public override void Activate()
 {
     DetectiveController.SetAlertForAllInstances(10f);
     button.SetRemainingDelayTime(30);
 }