Esempio n. 1
0
    /// <summary>
    /// Halts uploading upon player leaving hack area
    /// </summary>
    /// <param name="col"></param>
    private void OnTriggerExit2D(Collider2D col)
    {
        if (col.gameObject.tag == "Player")
        {
            hackStart = false;

            float fadeTime = 0.1f;
            // Check which element is visible to play appropriate fade out animation.
            if (loadingBarActive)
            {
                // Fade out the loading bar.
                // Set the loading bar element alphas to 1.
                changeAlphaTo(LoadingBar, 1f);
                changeAlphaTo(LoadingBarSpin, 1f);
                changeAlphaTo(LoadingFrame, 1f);
                changeAlphaTo(LoadingBG, 1f);
                changeAlphaTo(LoadingPercent, 1f);

                // Start loading bar elements alpha tweens to 0.
                LoadingBar.DOFade(0, fadeTime);
                LoadingBarSpin.DOFade(0, fadeTime);
                LoadingFrame.DOFade(0, fadeTime);
                LoadingBG.DOFade(0, fadeTime);
                LoadingPercent.DOFade(0, fadeTime);
            }
            else if (hackDialogActive)
            {
                // Fade out the hack dialog.
                // Set dialog's alpha to 1.
                changeAlphaTo(HackDialogBG, 1f);
                changeAlphaTo(QTEButton1, 1f);
                changeAlphaTo(QTEButton2, 1f);
                changeAlphaTo(QTEButton3, 1f);

                // Start dialog's alpha tween to 0.
                HackDialogBG.DOFade(0, fadeTime);
                QTEButton1.DOFade(0, fadeTime);
                QTEButton2.DOFade(0, fadeTime);
                QTEButton3.DOFade(0, fadeTime);
                HackDialogChevron1.DOFade(0, fadeTime);
                HackDialogChevron2.DOFade(0, fadeTime);
                HackDialogChevron3.DOFade(0, fadeTime);
            }

            resetHackLoadingBar();
            StopCoroutine(Uploading());

            loadingBarActive      = false;
            hackDialogActive      = false;
            LoadingBar.fillAmount = 0;
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Swap the loading bar with the hack dialog through an animation.
    /// </summary>
    /// <returns></returns>
    private IEnumerator QTEStartAnimation()
    {
        // Define some animation time variables.
        float fadeTime = 0.1f;

        // Set dialog's alpha to 0.
        changeAlphaTo(HackDialogBG, 0f);
        changeAlphaTo(QTEButton1, 0f);
        changeAlphaTo(QTEButton2, 0f);
        changeAlphaTo(QTEButton3, 0f);

        // Set the loading bar element alphas to 1.
        changeAlphaTo(LoadingBar, 1f);
        changeAlphaTo(LoadingBarSpin, 1f);
        changeAlphaTo(LoadingFrame, 1f);
        changeAlphaTo(LoadingBG, 1f);
        changeAlphaTo(LoadingPercent, 1f);

        // Start loading bar elements alpha tweens to 0.
        LoadingBar.DOFade(0, fadeTime);
        LoadingBarSpin.DOFade(0, fadeTime);
        LoadingFrame.DOFade(0, fadeTime);
        LoadingBG.DOFade(0, fadeTime);
        LoadingPercent.DOFade(0, fadeTime);

        // Wait for the fade out tween to finish.
        yield return(new WaitForSeconds(fadeTime));

        loadingBarActive = false;

        // Start dialog's alpha tween to 1.
        HackDialogBG.DOFade(1, fadeTime);
        QTEButton1.DOFade(1, fadeTime);
        QTEButton2.DOFade(1, fadeTime);
        QTEButton3.DOFade(1, fadeTime);

        hackDialogActive = true;

        // Run the QTE mechanisms.
        QTEManager.gameObject.SetActive(true);
    }