Ejemplo n.º 1
0
    void Update()
    {
        if (!helicopterInfo.bIsFlyable)
        {
            bMissionFailed = true;
        }

        if (!bRepairing && helicopterInfo.bIsFlyable && !helicopterInfo.bIsEngineStart)
        {
            bRepairing = true;
            StartCoroutine(Repair());
        }
        else
        {
            if (bRepairing)
            {
                StopCoroutine(Repair());
            }
        }

        if ((bMissionAccomplished || bMissionFailed) && !bMissionEnd)
        {
            bMissionEnd = true;
            cvsInfo.SetActive(false);

            if (bMissionAccomplished)
            {
                objAccomplishedPanel.SetActive(true);
                audioSource.PlayOneShot(sfxAccomplished);
            }
            else if (bMissionFailed)
            {
                objFailedPanel.SetActive(true);
                audioSource.PlayOneShot(sfxFailed);
            }

            sfc.FadeOutAndIn(delegate {
                trsCamera.parent            = null;
                motionInput.UseAutoRotation = false;
                motionInput.SetInputValues();
                trsCamera.position = objMissionEndCameraPos.position;
                trsCamera.rotation = objMissionEndCameraPos.rotation;
            });
        }

        // 인게임 메뉴
        if (helicopterInfo.bIsFlyable && (Input.GetButtonDown("FaceButtonB") || Input.GetKeyDown(KeyCode.Escape)))
        {
            objPanelInGameMenu.SetActive(!objPanelInGameMenu.activeInHierarchy);
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (!helicopterInfo.bIsFlyable)
        {
            StopCoroutine(TutorialNarrStart());
        }

        // 임무가 끝나버림
        if (bTutorialEnd && (bTutorialFailed || bTutorialSuccess))
        {
            inputController.bControllable = false;
            objCanvasInfo.SetActive(false);

            if (!bFadeOutAndInCalled)
            {
                if (audioSource.isPlaying)
                {
                    audioSource.Stop();
                }

                if (bTutorialFailed)
                {
                    audioSource.PlayOneShot(sfxMissionFailed);
                }
                else if (bTutorialSuccess)
                {
                    audioSource.PlayOneShot(sfxMissionSuccess);
                }

                if (motionInput.UseAutoRotation)
                {
                    motionInput.UseAutoRotation = false;
                    motionInput.SetInputValues(0.0f);
                }

                bFadeOutAndInCalled = true;

                sfc.FadeOutAndIn(delegate {
                    trsMainCamera.SetParent(trsMissionEndPosition);
                    trsMainCamera.localPosition = Vector3.zero;
                    trsMainCamera.localRotation = Quaternion.identity;

                    if (bTutorialFailed)
                    {
                        objFailedPanel.SetActive(true);
                    }
                    else if (bTutorialSuccess)
                    {
                        objSuccessPanel.SetActive(true);
                    }
                });
            }
        }

        // 추락하여 망가짐
        if (!helicopterInfo.bIsFlyable)
        {
            SetMissionValue(false);
        }

        // 인게임 메뉴
        if (helicopterInfo.bIsFlyable && (Input.GetButtonDown("FaceButtonB") || Input.GetKeyDown(KeyCode.Escape)))
        {
            objPanelInGameMenu.SetActive(!objPanelInGameMenu.activeInHierarchy);
        }
    }
Ejemplo n.º 3
0
    void Update()
    {
        if (nNumPassages == nPassedPassages)
        {
            textGoalLeft.text = "RUSH TO THE LAST GOAL";
        }
        else
        {
            textGoalLeft.text = "GOAL LEFT: " + (nNumPassages - nPassedPassages) + "/" + nNumPassages;
        }


        // 다음 목표 표시(Target Navigation)
        if (nPassedPassages < rpbPassages.Length)
        {
            Vector3 v3PosNav = rpbPassages[nPassedPassages].transform.position;
            objTargetNav.transform.position = v3PosNav;
        }
        else
        {
            Vector3 v3PosNav = objGoal.transform.position;
            objTargetNav.transform.position = v3PosNav;
        }

        if (!bIsOnCountdown && !trsPlayer.GetComponent <HelicopterInfo>().bIsFlyable&& !bAccomplished)
        {
            bGameOver = true;
            if (!panelGameOver.activeInHierarchy)
            {
                panelGameOver.SetActive(true);
                audioSourceSFX.Stop();
                audioSourceSFX.PlayOneShot(sfxFailedDestroyed);
            }
        }

        if (bGameOver || bAccomplished)
        {
            audioSourceBGM.Stop();
            audioSourceBGM.loop = true;

            audioSourceSFX.volume = 1.0f;

            if (trsCamera.parent != null)
            {
                trsCamera.SetParent(null);

                objInfoPanel.SetActive(false);

                sceneFadingController.FadeOutAndIn(delegate {
                    trsCamera.position = trsEndMissionCamPos.position;
                    trsCamera.rotation = trsEndMissionCamPos.rotation;

                    if (bAccomplished)
                    {
                        audioSourceSFX.PlayOneShot(sfxWinTheRace);
                        audioSourceSFX.PlayOneShot(sfxAccomplished);
                    }
                    else if (bGameOver)
                    {
                        audioSourceSFX.PlayOneShot(sfxFailed);
                    }
                });
            }

            if (motionInput.UseAutoRotation)
            {
                motionInput.UseAutoRotation = false;
                motionInput.SetInputValues(0.0f);
            }

            // 임무 실패
            if (bGameOver)
            {
                if (!panelGameOver.activeInHierarchy)
                {
                    panelGameOver.SetActive(true);
                }
            }
            // 임무 성공
            if (bAccomplished)
            {
                if (!panelAccomplished.activeInHierarchy)
                {
                    panelAccomplished.SetActive(true);
                }
            }

            if (bTimerTicking)
            {
                StopCoroutine("StartTimer");
            }
        }

        // 인게임 메뉴
        if (!(bGameOver || bAccomplished) && helicopterInfo.bIsFlyable && (Input.GetButtonDown("FaceButtonB") || Input.GetKeyDown(KeyCode.Escape)))
        {
            objPanelInGameMenu.SetActive(!objPanelInGameMenu.activeInHierarchy);
        }
    }
    void Update()
    {
        // 고도 제한
        if (trsPlayer.position.y > fMaxHeight)
        {
            if (!bIsTooHigh)
            {
                txtAltitude.color = Color.red;
                StartCoroutine("AltitudeWarning");
            }
        }
        else
        {
            if (bIsTooHigh)
            {
                txtAltitude.color = new Color(0.9296875f, 0.9296875f, 0.9296875f);
                if (txtCountdown.gameObject.activeInHierarchy)
                {
                    txtCountdown.gameObject.SetActive(false);
                }
                StopCoroutine("AltitudeWarning");
                bIsTooHigh = false;
            }
        }

        // 추락사
        if (!helicopterInfo.bIsFlyable && !bMissionEnd)
        {
            AudioSource a = gameObject.AddComponent <AudioSource>();
            a.PlayOneShot(sfxFailedByDestroyed);

            bMissionEnd    = true;
            bMissionFailed = true;
        }

        // 승리조건
        if (dzBehaviour.Length == nCurrentReceiver)
        {
            bMissionEnd = true;
        }

        // 임무가 끝나버림
        if (bMissionEnd && (bMissionAccomplished || bMissionFailed))
        {
            inputController.bControllable = false;
            objCanvasInfo.SetActive(false);

            if (objBGMPlayer != null)
            {
                objBGMPlayer.SetActive(false);
            }

            if (!bFadeOutAndInCalled)
            {
                if (audioSource.isPlaying)
                {
                    audioSource.Stop();
                }

                if (bMissionFailed)
                {
                    audioSource.PlayOneShot(sfxMissionFailed);
                }
                else if (bMissionAccomplished)
                {
                    audioSource.PlayOneShot(sfxMissionSuccess);
                }

                if (motionInput.UseAutoRotation)
                {
                    motionInput.UseAutoRotation = false;
                    motionInput.SetInputValues(0.0f);
                }

                bFadeOutAndInCalled = true;

                sfc.FadeOutAndIn(delegate {
                    trsMainCamera.SetParent(trsMissionEndPosition);
                    trsMainCamera.localPosition = Vector3.zero;
                    trsMainCamera.localRotation = Quaternion.identity;

                    if (bMissionFailed)
                    {
                        objFailedPanel.SetActive(true);
                    }
                    else if (bMissionAccomplished)
                    {
                        objSuccessPanel.SetActive(true);
                    }
                });
            }
        }

        // UI
        if (dzBehaviour.Length - nCurrentReceiver > 0)
        {
            txtObjectRemained.text = "OBJ: " + (dzBehaviour.Length - nCurrentReceiver) + " LEFT";
        }
        else
        if (txtObjectRemained.enabled)
        {
            txtObjectRemained.enabled = false;
        }
        txtPackageLoaded.enabled = (helicopterInfo.objCargo != null);
        // 인게임 메뉴
        if (!bMissionEnd && helicopterInfo.bIsFlyable && (Input.GetButtonDown("FaceButtonB") || Input.GetKeyDown(KeyCode.Escape)))
        {
            objPanelInGameMenu.SetActive(!objPanelInGameMenu.activeInHierarchy);
        }
    }