Пример #1
0
    protected override void PausedUpdate()
    {
        float delta = GlobalTimeManager.getDeltaTime();

        if (spawning && (lifeTimeSpawned + delta) < time.getTimeLeft())
        {
            lifeTimeSpawned += delta;
        }


        subtractText.text = "-" + Timer.formatTime(lifeTimeSpawned);
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (removeTime(GlobalTimeManager.getDeltaTime()))
        {
            //Game Over
        }

        if (display != null)
        {
            display.text = formatTime(timeLeft);
        }
    }
    private void updateGameplayStack()
    {
        Vector3 finalPosition = Vector3.zero;
        Vector3 finalTarget   = Vector3.zero;

        float totalBlend = 0;
        int   length     = gameCamStack.Count;

        for (int i = 0; i < length; i++)
        {
            CameraStackData c = gameCamStack.First.Value;

            float apparentBlending = 1.0f - totalBlend;
            //Hacky way to increment blend amount
            if (c.desiredBlend <= 0)
            {
                break;
            }
            else if (c.desiredBlend < 1.0)
            {
                c.desiredBlend += c.blendIncrement != -1.0f?c.blendIncrement * GlobalTimeManager.getDeltaTime():1.0f;
            }

            apparentBlending = apparentBlending > c.desiredBlend ? c.desiredBlend : apparentBlending;
            //Add to vector based on apparent blending amount
            finalPosition += c.cam.getPosition() * apparentBlending;
            finalTarget   += c.cam.getTarget() * apparentBlending;

            totalBlend += apparentBlending;

            //Move camera to end of stack
            gameCamStack.RemoveFirst();
            //If the camera isn't visible, remove it forever from the stack
            if (apparentBlending > 0)
            {
                gameCamStack.AddLast(c);
            }
            else
            {
                c.cam.Discard();
            }
        }

        this.mainCam.transform.position = finalPosition;
        this.mainCam.gameObject.transform.LookAt(finalTarget);
    }