Exemple #1
0
    IEnumerator TimerCor()
    {
        while (GameTimer > 0)
        {
            _timerText.text       = "" + ((int)GameTimer);
            _timerLine.localScale = new Vector3((GameTimer / 30.0f), 1, 1);
            //_timerLine.localScale = new Vector3(GameTimer/(30.0f-(GlobalLevel*3)),1,1);
            GameTimer -= GamePaused ? 0 : Time.deltaTime;
            yield return(new WaitForEndOfFrame());
        }

        ///Время кончилось

        GameTimer = 0;

        BlockControll = true;

        _trueVariantOfElement.MarkeredLine();

        _resultText.InvokeFade("Время вышло!");

        //GlobalLevel = 0;
        MainLevel -= 2;
        if (MainLevel < 0)
        {
            MainLevel = 0;
        }
        PointLevel = 0;

        foreach (var point in _points)
        {
            point.InvokeFadeOut();
        }

        StartCoroutine(StartNewLevel());
    }
Exemple #2
0
    public void TriggerFigure(bool trueVar, float sizeFigure)
    {
        WinAndAtt.y++;
        //BlockControll = true;

        _trueVariantOfElement.MarkeredLine();

        StopCoroutine(_corTimer);

        if (trueVar)
        {
            ///Выбран правильный вариант
            _resultText.InvokeFade("То что нужно!");
            WinAndAtt.x++;
            if (GameTimer >= 13)
            {
                if (GameTimer >= 18)
                {
                    if (GameTimer >= 23)
                    {
                        if (GameTimer >= 27)
                        {
                            _fancyText.InvokeFade("Браво!");
                        }
                        else
                        {
                            _fancyText.InvokeFade("Прекрасно!");
                        }
                    }
                    else
                    {
                        _fancyText.InvokeFade("Хорошо!");
                    }
                }
                else
                {
                    _fancyText.InvokeFade("Неплохо");
                }
            }

            PointLevel++;
            _points[PointLevel - 1].InvokeFadeIn();
            _fadeOnSceneText.SetText("");
            if (PointLevel > 2)
            {
                PointLevel = 0;
                MainLevel++;
                _fadeOnSceneText.SetText("LEVEL " + (MainLevel + 1));
//                if (MainLevel > 2)
//                {
//                    MainLevel = 0;
////                    GlobalLevel++;
////                    if (GlobalLevel > 10)
////                    {
////                        GlobalLevel = 10;
////                    }
//                }
            }
        }
        else
        {
            ///Выбран неправильный вариант
            if (sizeFigure > TrueSize)
            {
                _resultText.InvokeFade("Слишком велик");
            }
            else
            {
                _resultText.InvokeFade("Слишком мал");
            }

            //GlobalLevel = 0;
            MainLevel -= 2;
            if (MainLevel < 0)
            {
                MainLevel = 0;
            }
            PointLevel = 0;
            _fadeOnSceneText.SetText(_SorryTexts[Random.Range(0, _SorryTexts.Length)]);

            foreach (var point in _points)
            {
                point.InvokeFadeOut();
            }
        }

        _textWinAndAtt.text = "[" + WinAndAtt.x + "-" + WinAndAtt.y + "]";
        //Debug.Log("POINT "+PointLevel+"; LEVEL "+MainLevel);
        _menuSystem.SaveGame();
        StartCoroutine(StartNewLevel());
    }
Exemple #3
0
    IEnumerator StartNewLevel()
    {
        float timerLocal = 1.85f;

        if (!FirstStart)
        {
            _fadeOnSceneText.InvokeFade();

            while (timerLocal > 0)
            {
                timerLocal -= Time.deltaTime;
                yield return(new WaitForEndOfFrame());
            }



            timerLocal = 0;
            while (timerLocal < 1f)
            {
                _fadeOnScene.color = new Color(
                    _fadeOnScene.color.r,
                    _fadeOnScene.color.g,
                    _fadeOnScene.color.b,
                    timerLocal / 1f);



                timerLocal += Time.deltaTime;
                yield return(new WaitForEndOfFrame());
            }
        }
        else
        {
            _fadeOnSceneText.SetText("");
        }

        _fadeOnScene.color = new Color(
            _fadeOnScene.color.r,
            _fadeOnScene.color.g,
            _fadeOnScene.color.b,
            1);



        GenerateNewLevel();

        _levelText.text = "LEVEL " + (MainLevel + 1);

        if (PointLevel == 0)
        {
            foreach (var point in _points)
            {
                point.InvokeFadeOut();
            }
        }

        timerLocal = 1f;
        while (timerLocal > 0)
        {
            _fadeOnScene.color = new Color(
                _fadeOnScene.color.r,
                _fadeOnScene.color.g,
                _fadeOnScene.color.b,
                timerLocal / 1f);



            timerLocal -= Time.deltaTime;
            yield return(new WaitForEndOfFrame());
        }

        _fadeOnScene.color = new Color(
            _fadeOnScene.color.r,
            _fadeOnScene.color.g,
            _fadeOnScene.color.b,
            0);



        BlockControll = false;
        GameTimer     = 30.0f;
        //GameTimer = (30.0f-(GlobalLevel*3));
        if (FirstStart)
        {
            GamePaused = false;
            FirstStart = false;
        }
        _corTimer = StartCoroutine(TimerCor());
    }