示例#1
0
    private void GameLoop()
    {
        // If it's time to spawn another cut.
        if (timeIntervalCounter > Mathf.Lerp(activeDifficultySettings.InitialSpawnInterval,
                                             activeDifficultySettings.EndSpawnInterval,
                                             activeDifficultySettings.SpawnCurve.Evaluate(timeCounter / CountdownObj.StartTime)) &&
            CutPrefab.SpawnTime < CountdownObj.CurrentTimeRemaining)
        {
            // TODO: maybe add a parent to keep the scene clean.
            var         cutPosition = GenerateNewCutPosition();
            NewCutPoint clone       = Instantiate(CutPrefab, cutPosition, Quaternion.identity, cutContainer.transform);
            // TODO: this is a bit messy, move GemObject calculation somewhere else.
            clone.CutVector          = -(cutPosition - GemSpawnManager.Gem.transform.position) * 1.8f;  // make the vector a bit longer.
            clone.onSpawnComplete   += cut => activeCuts.AddLast(cut);
            clone.onTimeoutComplete += cut => activeCuts.Remove(cut);
            SFX.Play("Cutting_circle_appears");

            timeIntervalCounter = 0;
        }

        // If player is struggling, show instructions again.
        if (missDurationCounter > MissDurationTimeout)
        {
            missDurationCounter = 0;
            InstructionManager.PushInstruction();
        }

        timeIntervalCounter += Time.deltaTime;
        timeCounter         += Time.deltaTime;
        missDurationCounter += Time.deltaTime;
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (!start)
        {
            _currentRuneSprite.SetActive(false);
            return;
        }

        if (_canTrace)
        {
            FadeInRune();
            currentTime = Time.time;
            GetInput();

            if (missDurationCounter > MissDurationTimeout)
            {
                missDurationCounter = 0;
                instructionManager.PushInstruction();
            }

            missDurationCounter += Time.deltaTime;
        }

        if (Time.time > finishTime && _canTrace)
        {
            //GameOver();
        }
    }
示例#3
0
    void Update()
    {
        if (!start)
        {
            return;
        }

        // If player seems to be struggling, show instructions again.
        if (missDurationCounter > MissDurationTimout)
        {
            missDurationCounter = 0;
            instructionManager.PushInstruction();
        }

        missDurationCounter += Time.deltaTime;
        timeCounter         += Time.deltaTime;

        // Check where we are running the program.
        RuntimePlatform p = Application.platform;

        if (p == RuntimePlatform.WindowsEditor || p == RuntimePlatform.WindowsPlayer || p == RuntimePlatform.OSXEditor || p == RuntimePlatform.OSXPlayer)
        {
            // Process mouse inputs.
            ProcessMouse();
        }
        else if (p == RuntimePlatform.IPhonePlayer || p == RuntimePlatform.Android)
        {
            // Process touch inputs.
            ProcessTouch();
        }
    }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        if (!start)
        {
            return;
        }

        if (!gameOver)
        {
            GetInput();
            ObjectColourLerp();
            timerSlider.value    = currentTime;
            timerSlider.minValue = startTime;
            timerSlider.maxValue = finishTime;
            Color sliderColour = Color.Lerp(Color.green, Color.red, timerSlider.value / timerSlider.maxValue);
            sliderImage.color = sliderColour;
            //CalculateRelevantSFX();

            if (missDurationCounter > missDurationTimeout)
            {
                missDurationCounter = 0;
                InstructionManager.PushInstruction();
            }

            missDurationCounter += Time.deltaTime;
        }
        else
        {
            //GameOver();
        }
    }