Beispiel #1
0
        public void SetPutItemPopUp(PutItemPoint curPutPoint)
        {
            Vector3 screenPoint = Camera.main.WorldToScreenPoint(curPutPoint.transform.position);

            putItemPopUp.transform.position = screenPoint;
            putItemPopUp.gameObject.SetActive(true);
        }
Beispiel #2
0
        /// <summary>
        /// Called when the item steal button is pushed. Set item to thief player and activate put point popup.
        /// </summary>
        public void OnStealButton()
        {
            ThiefController.LocalThief.photonView.
            RPC("StealItemInPoint", PhotonTargets.AllViaServer, CurGenPoint.Index);
            //MultiplayRoomManager.Instance.photonView.RPC("SetStealAlert", PhotonTargets.All, CurGenPoint.Index);
            PutItemPoint.SetPointPopup(true);

            gameObject.SetActive(false);
        }
Beispiel #3
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();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Put current stolen item to this point.
        /// </summary>
        public void OnPutItemButton()
        {
            ThiefController localThief = ThiefController.LocalThief;

            MultiplayRoomManager.Instance.photonView
            .RPC("StealSuccess", PhotonTargets.AllViaServer, PhotonNetwork.player.ID, localThief.ItemInHand.GenPoint.Index);
            localThief.photonView.RPC("PutItemInPoint", PhotonTargets.All);
            PutItemPoint.SetPointPopup(false);

            gameObject.SetActive(false);
        }