Exemplo n.º 1
0
    /// <summary>
    /// 다음 스폰 지점 보기
    /// </summary>
    public void NextSpawnPos()
    {
        if (SpawnPosContainer.instance.selectedSpawnPosIdx == SpawnPosContainer.instance.spawnPos.Length - 1)
        {
            SpawnPosContainer.instance.selectedSpawnPosIdx = 0;
        }
        else
        {
            SpawnPosContainer.instance.selectedSpawnPosIdx++;
        }

        highlightSound.PlayHighlightSound();
        MoveCameraToSpawnPos();
        DescTitle();
    }
Exemplo n.º 2
0
    /// <summary>
    /// 메뉴 탭 내 시점 전환 버튼 제어 코루틴
    /// </summary>
    IEnumerator SetViewSupporter()
    {
        // 조이스틱 시점 전환시 axis가 0이 아닐 때 한 번만 동작되도록 막기 위한 플레그
        // -1: -1 axis 방향으로 동작된 상태
        // 0: 대기 상태
        // 1: 1 axis 방향으로 동작된 상태
        int axisOnlyOnceWorkFlag = 0;

        StandaloneInputModule module = eventSystem.GetComponent <StandaloneInputModule>();

        List <int> viewKey = new List <int>();
        //viewKey.Add(1); // 플레이어 조종, 플레이어 시점, Player
        //viewKey.Add(3); // 드론 조종, 드론 3인칭 시점, TPV
        //viewKey.Add(4); // 드론 조종, 드론 1인칭 시점, FPV
        //viewKey.Add(2); // 드론 조종, 플레이어 시점, PPV

        Text text = eventSystem.currentSelectedGameObject.GetComponentInChildren <Text>();

        #region init

        switch (PlayerController.instance.curViewPoint)
        {
        case 1:
            viewKey.Add(1);
            viewKey.Add(3);
            viewKey.Add(4);
            viewKey.Add(2);

            text.text = "Player";
            break;

        case 3:
            viewKey.Add(3);
            viewKey.Add(4);
            viewKey.Add(2);
            viewKey.Add(1);

            text.text = "TPV";
            break;

        case 4:
            viewKey.Add(4);
            viewKey.Add(2);
            viewKey.Add(1);
            viewKey.Add(3);

            text.text = "FPV";
            break;

        case 2:
            viewKey.Add(2);
            viewKey.Add(1);
            viewKey.Add(3);
            viewKey.Add(4);

            text.text = "PDV";
            break;
        }

        #endregion

        while (eventSystem.currentSelectedGameObject.name == "SetView")
        {
            if (Input.GetButtonDown(module.submitButton))
            {
                PlayerController.instance.SetViewPoint(viewKey[0]);
            }

            if (Input.GetAxis(module.horizontalAxis) == 0)
            {
                axisOnlyOnceWorkFlag = 0;
            }

            else if (Input.GetAxis(module.horizontalAxis) > 0 && axisOnlyOnceWorkFlag != 1)
            {
                axisOnlyOnceWorkFlag = 1; // 연속 동작 방지 플래그

                // (1)-2-3-4   ->   (2)-3-4-1.
                // 제일 앞 값을 뒤로 돌리고
                // (2) 를 매개변수로 시점 전환.
                int key = viewKey[0];
                viewKey.RemoveAt(0);
                viewKey.Insert(viewKey.Count, key);

                highlightSound.PlayHighlightSound();

                Input.ResetInputAxes();
            }
            else if (Input.GetAxis(module.horizontalAxis) < 0 && axisOnlyOnceWorkFlag != -1)
            {
                axisOnlyOnceWorkFlag = -1; // 연속 동작 방지 플래그

                // (1)-2-3-4   ->   (4)-1-2-3
                // 제일 뒤 값을 앞으로 돌리고
                // (4)를 매개변수로 시점 전환
                int key = viewKey[viewKey.Count - 1];
                viewKey.RemoveAt(viewKey.Count - 1);
                viewKey.Insert(0, key);

                highlightSound.PlayHighlightSound();

                Input.ResetInputAxes();
            }

            text.text = GetCurViewPointName(viewKey[0]);

            yield return(null);
        }
    }