Пример #1
0
        private void Start()
        {
            FadeHelper fader = transform.GetOrAddComponent <FadeHelper>();

            fader.fadeAplha = 0.01f;
            fader.FadeOut();
        }
Пример #2
0
    IEnumerator CoInit()
    {
        if (optionCanvas == null)
        {
            Time.timeScale = 1f;
            yield return(SceneManager.LoadSceneAsync("OptionScene", LoadSceneMode.Additive));

            optionCanvas  = GameObject.Find("OptionCanvas");
            popupExit     = GameObject.Find("PopupExit");
            imgBlackBoard = GameObject.Find("ImgBlackBoard").GetComponent <Image>();
            btnExitAccept = GameObject.Find("BtnExitAccept").GetComponent <Button>();
            btnExitCancel = GameObject.Find("BtnExitCancel").GetComponent <Button>();
            btnExitAccept.onClick.AddListener(OnClickExitAccept);
            btnExitCancel.onClick.AddListener(OnClickExitCancel);
            popupExit.gameObject.SetActive(false);
        }
        yield return(new WaitForSeconds(0.5f));

        FadeHelper.FadeOut(imgBlackBoard, 1f);

        Scene curScene = SceneManager.GetActiveScene();

        switch (curScene.name)
        {
        case "TitleScene":
            audioSource.Play();
            break;

        case "GameScene":
            break;

        default:
            break;
        }
    }
Пример #3
0
    IEnumerator CoPlayGame()
    {
        Time.timeScale = 1f;
        cinematicManager.btnSkip.enabled      = false;
        cinematicManager.btnBeginPlay.enabled = false;
        cinematicManager.btnGoToTitle.enabled = false;

        Tweener tween = FadeHelper.FadeIn(imgBlackBoard, 1f);

        yield return(new WaitWhile(() => tween.IsPlaying()));

        cinematicManager.HidePrologue();
        audioSource.DOFade(0f, 1f);
        yield return(new WaitForSeconds(1f));

        audioSource.Stop();
        audioSource.volume = 1f;
        Camera.main.GetComponent <AudioListener>().enabled = false;
        yield return(SceneManager.LoadSceneAsync("GameScene", LoadSceneMode.Additive));

        yield return(SceneManager.UnloadSceneAsync("TitleScene"));

        yield return(SceneManager.UnloadSceneAsync("CinematicScene"));

        FadeHelper.FadeOut(imgBlackBoard, 1f);
        gameState = eGameState.playingGame;
    }
Пример #4
0
    IEnumerator CoShowPrologue()
    {
        isPlayingPrologue = true;

        btnSkip.transform.localScale = Vector3.zero;
        btnSkip.gameObject.SetActive(true);
        btnSkip.transform.DOScale(Vector3.one, 0.5f)
        .SetEase(Ease.OutQuad);

        for (int i = 0; i < arrImgPrologue.Length; i++)
        {
            FadeHelper.FadeIn(arrImgPrologue[i], 1f);
            ChatText(textIntervalSecond, textVariabilitySecond, arrStrPrologue[i]);
            yield return(new WaitWhile(() => isChatting));

            yield return(new WaitUntil(() => Input.GetMouseButton(0)));

            textTouch.gameObject.SetActive(false);
            FadeHelper.FadeOut(arrImgPrologue[i], 1f);
        }

        btnSkip.transform.DOScale(Vector3.zero, 0.5f)
        .SetEase(Ease.InQuad)
        .OnComplete(() => btnSkip.gameObject.SetActive(false));

        btnBeginPlay.transform.localScale = Vector3.zero;
        btnBeginPlay.gameObject.SetActive(true);
        btnBeginPlay.transform.DOScale(Vector3.one, 0.5f)
        .SetEase(Ease.OutQuad);

        routinePrologue = null;
    }
Пример #5
0
        /// <summary>
        /// Starts the display coroutine or the panel's fade depending on whether or not the current slot is empty
        /// </summary>
        /// <param name="item">Item.</param>
        public virtual void DisplayDetails(InventoryItem item)
        {
            if (InventoryItem.IsNull(item))
            {
                if (HideOnEmptySlot && !Hidden)
                {
                    StartCoroutine(FadeHelper.FadeCanvasGroup(_canvasGroup, _fadeDelay, 0f));
                    Hidden = true;
                }
                if (!HideOnEmptySlot)
                {
                    StartCoroutine(FillDetailFieldsWithDefaults(0));
                }
            }
            else
            {
                StartCoroutine(FillDetailFields(item, 0f));

                if (HideOnEmptySlot && Hidden)
                {
                    StartCoroutine(FadeHelper.FadeCanvasGroup(_canvasGroup, _fadeDelay, 1f));
                    Hidden = false;
                }
            }
        }
Пример #6
0
    IEnumerator CoRestart()
    {
        gameState      = eGameState.loading;
        Time.timeScale = 1f;
        Tweener tween = FadeHelper.FadeIn(imgBlackBoard, 1f);

        yield return(new WaitWhile(() => tween.IsPlaying()));

        yield return(new WaitForSeconds(1f));

        yield return(SceneManager.LoadSceneAsync("GameScene"));

        FadeHelper.FadeOut(imgBlackBoard, 1f);
        gameState = eGameState.playingGame;
    }
Пример #7
0
    IEnumerator CoClickEnding()
    {
        Time.timeScale = 1f;
        yield return(null);

        Tweener tween = FadeHelper.FadeIn(imgBlackBoard, 1f);

        yield return(new WaitWhile(() => tween.IsPlaying()));

        yield return(SceneManager.LoadSceneAsync("CinematicScene", LoadSceneMode.Additive));

        cinematicManager = GameObject.Find("CinematicManager").GetComponent <CinematicManager>();
        cinematicManager.btnGoToTitle.onClick.AddListener(OnClickGoToTitle);
        cinematicManager.btnSkip.onClick.AddListener(cinematicManager.HideEnding);
        cinematicManager.ShowEnding();
        FadeHelper.FadeOut(imgBlackBoard, 1f);
    }
Пример #8
0
    IEnumerator CoBeginPlay()
    {
        gameState      = eGameState.loading;
        Time.timeScale = 1f;
        Tweener tween = FadeHelper.FadeIn(imgBlackBoard, 1f);

        yield return(new WaitWhile(() => tween.IsPlaying()));

        yield return(SceneManager.LoadSceneAsync("CinematicScene", LoadSceneMode.Additive));

        cinematicManager = FindObjectOfType <CinematicManager>().GetComponent <CinematicManager>();
        cinematicManager.btnBeginPlay.onClick.AddListener(OnClickPlayGame);
        cinematicManager.btnSkip.onClick.AddListener(OnClickPlayGame);
        cinematicManager.ShowPrologue();
        FadeHelper.FadeOut(imgBlackBoard, 1f);
        GameObject.Find("TitleCanvas").SetActive(false);
    }
Пример #9
0
    IEnumerator CoShowCredit()
    {
        yield return(null);

        ChatText(textIntervalSecond, textVariabilitySecond, strCredit);
        yield return(new WaitWhile(() => isChatting));

        yield return(new WaitForSeconds(1f));

        Tweener tween = FadeHelper.FadeIn(GameManager.Instance.imgBlackBoard, 1f);

        yield return(tween.WaitForCompletion());

        yield return(new WaitForSeconds(2f));

        GameManager.Instance.OnClickGoToTitle();
    }
Пример #10
0
    IEnumerator CoGoToTitle()
    {
        Time.timeScale = 1f;
        yield return(null);

        Tweener tween = FadeHelper.FadeIn(imgBlackBoard, 1f);

        yield return(new WaitWhile(() => tween.IsPlaying()));

        OnClickExitCancel();
        yield return(SceneManager.LoadSceneAsync("TitleScene"));

        GameObject.Find("BeginButton").GetComponent <Button>().onClick.AddListener(OnClickBeginPlay);
        GameObject.Find("ExitButton").GetComponent <Button>().onClick.AddListener(PopupExitPanel);
        audioSource.Play();

        FadeHelper.FadeOut(imgBlackBoard, 1f);
    }
Пример #11
0
        private IEnumerator Transitioning()
        {
            float stateTime = 0f;

            FadeHelper.SetInteractCollider(this);
            HudManager.canvasFade.GetComponent <Animator>().SetTrigger("startFade");
            while (stateTime < seconds)
            {
                HudManager.host.gameObject.SetActive(false);
                cam.GetComponent <CameraParallax>().enabled = false;
                cam.transform.position = Vector3.Lerp(cam.transform.position, target, (stateTime / seconds));
                //lerpTimeCurrent += lerpTimeIncrement;
                stateTime += Time.deltaTime;
                //Debug.Log("lerpTimeCurrent Increment: " + lerpTimeCurrent);
                yield return(new WaitForEndOfFrame());
            }

            //lerpTimeCurrent = lerpTimeStart;
        }
Пример #12
0
    IEnumerator CoShowEnding()
    {
        isPlayingEnding = true;

        btnSkip.transform.localScale = Vector3.zero;
        btnSkip.gameObject.SetActive(true);
        btnSkip.transform.DOScale(Vector3.one, 0.5f)
        .SetEase(Ease.OutQuad);

        for (int i = 0; i < arrImgEnding.Length; i++)
        {
            if (i == 0)
            {
                AudioManager.PlaySound("EndingClap");
            }
            if (i == 2)
            {
                AudioManager.PlaySound("KJRShout");
            }

            FadeHelper.FadeIn(arrImgEnding[i], 1f);
            ChatText(textIntervalSecond, textVariabilitySecond, arrStrEnding[i]);
            yield return(new WaitWhile(() => isChatting));

            yield return(new WaitUntil(() => Input.GetMouseButton(0)));

            textTouch.gameObject.SetActive(false);
            FadeHelper.FadeOut(arrImgEnding[i], 1f);
        }

        btnSkip.transform.DOScale(Vector3.zero, 0.5f)
        .SetEase(Ease.InQuad)
        .OnComplete(() => btnSkip.gameObject.SetActive(false));

        btnGoToTitle.transform.localScale = Vector3.zero;
        btnGoToTitle.gameObject.SetActive(true);
        btnGoToTitle.transform.DOScale(Vector3.one, 0.5f)
        .SetEase(Ease.OutQuad);

        routineEnding = null;
    }
        public void Init(int size, Dictionary <Position, BoardSlot> slots)
        {
            if (GameGrid.Children.Count > 0)
            {
                GameGrid.Children.Clear();
                FadeHelper.FadeOut(GameOverUi);
            }

            Size = size;
            GameGrid.Children.Capacity = size * size;

            foreach (KeyValuePair <Position, BoardSlot> kv in slots)
            {
                BoardBlock block = new BoardBlock();

                GameGrid.Children.Add(block);

                Grid.SetColumn(block, kv.Key.X);
                Grid.SetRow(block, kv.Key.Y);
            }
        }
 public void RenderGameEnded()
 {
     FadeHelper.FadeIn(GameOverUi);
 }
Пример #15
0
        public Node compile(FeatureLayer layer, FeatureCursor cursor, string output_file)
        {
            osg.Node *result = NULL;

            if (!layer)
            {
                osgGIS.notify(osg.WARN) << "Illegal null feature layer" << std.endl;
                return(NULL);
            }

            osg.ref_ptr <osg.LOD> lod = new osg.LOD();

            if (getFadeLODs())
            {
                FadeHelper.enableFading(lod.getOrCreateStateSet());
            }

            for (FilterGraphRangeList.iterator i = graph_ranges.begin(); i != graph_ranges.end(); i++)
            {
                osg.Node *range = compile(layer, cursor, i.graph.get());
                if (range)
                {
                    lod.addChild(range, i.min_range, i.max_range);

                    if (getFadeLODs())
                    {
                        FadeHelper.setOuterFadeDistance(i.max_range, range.getOrCreateStateSet());
                        FadeHelper.setInnerFadeDistance(i.max_range - .2 * (i.max_range - i.min_range), range.getOrCreateStateSet());
                    }
                }
            }

            if (GeomUtils.hasDrawables(lod.get()))
            {
                if (getOverlay())
                {
                    result = convertToOverlay(lod.get());
                }
                else
                {
                    result = lod.release();
                }

                osgUtil.Optimizer opt;
                opt.optimize(result,
                             osgUtil.Optimizer.SPATIALIZE_GROUPS |
                             osgUtil.Optimizer.STATIC_OBJECT_DETECTION |
                             osgUtil.Optimizer.SHARE_DUPLICATE_STATE);

                if (getRenderOrder() >= 0)
                {
                    string bin_name = result.getOrCreateStateSet().getBinName();
                    result.getOrCreateStateSet().setRenderBinDetails(getRenderOrder(), bin_name);
                    result.getOrCreateStateSet().setAttributeAndModes(new osg.Depth(osg.Depth.ALWAYS), osg.StateAttribute.ON);
                }

                localizeResourceReferences(result);

                if (output_file.length() > 0)
                {
                    localizeResources(osgDB.getFilePath(output_file));
                }
            }

            return(result);
        }