예제 #1
0
        public void SetField()
        {
            _punTimer = new PunTimer();
            GameObject[] playerObjects = GameObject.FindGameObjectsWithTag(TagList.PlayerTag);
            int          playerCount   = playerObjects.Length;

            Player[]             playerObjOwner     = new Player[playerCount];
            PlayerChildrenList[] playerChildrenList = new PlayerChildrenList[playerCount];

            _myFlagDic = new Dictionary <Player, HavingFlagDic>();

            for (int i = 0; i < playerCount; i++)
            {
                //Debug.Log($"playerObjects[i] {playerObjects[i]}");
                playerObjOwner[i]     = playerObjects[i].GetComponent <PhotonView>().Owner;
                playerChildrenList[i] = playerObjects[i].GetComponent <PlayerChildrenList>();
                _myFlagDic.Add(playerObjOwner[i],
                               new HavingFlagDic(playerChildrenList[i].FlagImage, FirstFlagNum, playerChildrenList[i].FlagNum));
            }

            /*foreach (var myFlag in _myFlagDic)
             * {
             *  myFlag.Value.FlagNumText.text = $"{FirstFlagNum}";
             * }*/
        }
예제 #2
0
        //Game進行
        private async void Game()
        {
            CancellationToken token = this.GetCancellationTokenOnDestroy();

            await UniTask.Delay(ImageShowTimeMilli, cancellationToken : token);

            loadPanel.SetActive(false);
            //前半戦スタート
            BGMManager.Instance.Play(BGMPath.PORT_BGM);
            startimage.SetActive(true);
            firstAdvice.SetActive(true);
            Debug.Log("startTrue");

            FirstTimer = new PunTimer();
            await FirstTimer.TimerAsync(TimeLimit, timerText, token);

            //前半戦終了後後処理
            if ((int)RPCAwaitStateList.FirstInMain == (int)PhotonNetwork.LocalPlayer.CustomProperties[PunSettings.PropertiesKeyList.PlayerStateKey])
            {
                _rpcState.MyRPCStateSet(RPCAwaitStateList.SecondInMain);
            }
            else if ((int)RPCAwaitStateList.FirstInRoom == (int)PhotonNetwork.LocalPlayer.CustomProperties[PunSettings.PropertiesKeyList.PlayerStateKey])
            {
                _rpcState.MyRPCStateSet(RPCAwaitStateList.SecondInRoom);
            }

            if (PhotonNetwork.LocalPlayer.CustomProperties[PunSettings.PropertiesKeyList.RoomGateKey] == null)
            {
                new RoomGateMaker().MakeRoom(playerManager.myPlayerObj.transform, goodsTable);
                playerManager.haveMerchandise.ThrowItem(MerchandiseInfo.MerchandiseEnum.RoomMaker);
            }

            //後半戦準備
            BGMManager.Instance.Play(BGMPath.SUNRISE);
            secondAdvice.SetActive(true);
            _flagManager.SecondSetField();


            //後半戦
            SecondTimer = new PunTimer();
            await SecondTimer.TimerAsync(TimeLimit, timerText, token);


            Result();
        }