Esempio n. 1
0
    private void RPCCardUseData(int locX, int locY, int playerId, int value)
    {
        bool anotherCard;

        if (PhotonNetwork.IsMasterClient)
        {
            cardNum[playerId - 1] -= 1;
        }
        //playerId, cardId
        anotherCard = GameObject.Find("EventSystem").GetComponent <EventManager>().setSelectTiles(locX, locY, playerId, value);
        if (anotherCard)
        {
            EventManager.tileLocX.Add(locX);
            EventManager.tileLocY.Add(locY);
        }
        //17일 추가
        GameObject endTile = GameObject.Find(locX + ", " + locY);

        Transform[] endTileChilds;
        endTileChilds = endTile.GetComponentsInChildren <Transform>(true);

        if (endTileChilds.Length < 8)
        {
            PrefebManager.DestroyPrefebs(locX, locY);
            PrefebManager.CreatePrefeb(tokken[playerId - 1], locX, locY, choice_effect);
        }
        else
        {
            PrefebManager.DestroyPrefebs(locX, locY);
            PrefebManager.CreateSwordPrefeb(sword_ani, locX, locY, choice_effect);
        }
    }
Esempio n. 2
0
    private void RPCSelectBase(int locX, int locY, int playerId)
    {
        GameObject.Find("EventSystem").GetComponent <EventManager>().setOccTiles(locX, locY, playerId);

        GameObject go = GameObject.Find(locX + ", " + locY);

        go.GetComponent <Hex>().thisBaseCamp = true;

        //해당 타일에 베이스캠프 이미지를 구현
        PrefebManager.CreatePrefeb(castle[playerId - 1], locX, locY, myColor[playerId]);
    }
Esempio n. 3
0
    // 타일 위치에 관한 이벤트 처리
    IEnumerator RoundResult()
    {
        int          occPlayerId, checkPlayer, checkCard;
        List <Tiles> resultTiles = new List <Tiles>();

        //실행을 받으면 타일 하나씩 순회하면서 해당 타일의 최종 점령 playerId를 확인한다.
        //종료시점에 occPlayerId에 playerId를 넣고 occTile에 occPlayerId값을 입력, 종료시 타일 clear()
        for (int i = 0; i < tileLocX.Count; ++i)
        {
            resultTiles.Clear();
            occPlayerId = 0;
            LocX        = tileLocX[i];
            LocY        = tileLocY[i];

            Debug.Log("<color=red>Prefab create : </color>" + LocX + ", " + LocY);


            PrefebManager.CreateArrowPrefeb(arrow_tile, LocX, LocY);
            SoundManager.instance.PlayArrowSound();
            yield return(new WaitForSeconds(1));

            SoundManager.instance.PlayArrowSound();
            yield return(new WaitForSeconds(1));

            MouseScripts.result_pannel_roundover(LocX, LocY);
            for (int j = 0; j < selectTiles[LocX][LocY].Count; ++j)
            {
                checkPlayer = selectTiles[LocX][LocY][j].playerId;
                checkCard   = selectTiles[LocX][LocY][j].cardId;

                //사용 카드 처리
                switch (checkCard)
                {
                case 1:     //점령
                {
                    resultTiles.Add(new Tiles(checkPlayer, checkCard));
                    break;
                }

                case 2:     //방어
                {
                    //방어카드를 사용한 플레이어의 땅이라면?
                    if (occTiles[LocX, LocY] == checkPlayer)
                    {
                        int idx = 0;
                        while (idx < resultTiles.Count)
                        {
                            if (resultTiles[idx].playerId != checkPlayer)
                            {
                                Debug.Log("삭제! " + resultTiles[idx].playerId);
                                resultTiles.RemoveAt(idx);
                                break;
                            }
                            ++idx;
                        }
                    }
                    break;
                }

                case 3:     //매수
                {
                    int idx = 0;
                    while (idx < resultTiles.Count)
                    {
                        if (resultTiles[idx].cardId == 1)
                        {
                            resultTiles.RemoveAt(idx);
                        }
                        else
                        {
                            ++idx;
                        }
                    }
                    resultTiles.Add(new Tiles(checkPlayer, checkCard));
                    break;
                }

                default:     //블러핑
                    break;
                }
            }

            /* 게임창의 카드사용 개수가
             * 3개 이하이면 2초
             * 3개 초과이면 4초
             * 7개 이상이면 6초
             */
            GameObject content_go = GameObject.Find("war_result_Content");

            if (content_go.transform.childCount <= 10)
            {
                yield return(new WaitForSeconds(4));
            }



            //if (content_go.transform.childCount <= 3) {
            //    yield return new WaitForSeconds(2);
            //}
            //else if (3 < content_go.transform.childCount && content_go.transform.childCount < 6){
            //    yield return new WaitForSeconds(4);
            //}
            //else { yield return new WaitForSeconds(6); }
            MouseScripts.war_result_off();
            //탐색이 끝난 타일 초기화
            selectTiles[LocX][LocY].Clear();

            //프리팹 삭제
            PrefebManager.DestroyPrefebs(LocX, LocY);

            //변경값이 있는가
            if (resultTiles.Count > 0)
            {
                Debug.Log($"({LocX} , {LocY}) = {resultTiles[0].playerId}");
                occPlayerId = resultTiles[0].playerId;
            }

            //해당 타일 프리팹 생성
            if (occPlayerId != 0)
            {
                occTiles[LocX, LocY] = occPlayerId;
                PrefebManager.CreatePrefeb(flag[occPlayerId - 1], LocX, LocY, NetworkRoundManager.getMyColor(occPlayerId));
            }
            else if (occTiles[LocX, LocY] != 0)
            {
                int tempid = occTiles[LocX, LocY];
                PrefebManager.CreatePrefeb(flag[tempid - 1], LocX, LocY, NetworkRoundManager.getMyColor(tempid));
            }
            yield return(new WaitForSeconds(1));
        }

        //최종적으로 player_count를 재탐색하고 타일 초기화 -> occTile에 따른 결과 반영
        tileLocX.Clear();
        tileLocY.Clear();

        //라운드결과 종료 => 점령지, 점수 계산
        RoundResultEnd();

        NetworkRoundManager.nowRound += 1;

        Debug.Log("<color=red>nowRound, roundLimit : </color>" + NetworkRoundManager.nowRound + ", " + NetworkRoundManager.roundLimit);
        if (NetworkRoundManager.nowRound > NetworkRoundManager.roundLimit)
        {
            yield return(new WaitForSeconds(1));

            if (GameOver.player_is_win == true)
            {
                SoundManager.instance.audioSource.Stop();
                SoundManager.instance.PlayWinSound();
            }
            else
            {
                SoundManager.instance.audioSource.Stop();
                SoundManager.instance.PlayLoseSound();
            }
            game_result_pannel.SetActive(true);
        }
        else
        {
            yield return(new WaitForSeconds(1));

            //라운드 텍스트 이동
            NetworkRoundManager.roundProcessBool = false;
            TweenMoveObj();
        }
    }