Beispiel #1
0
    void Update()
    {
        playerPos = playerCon.PlayerPosition();

        //set camera follow point
        if (PlayerController.GetCurrentHealth() > 0)
        {
            camFollowPoint.transform.position = playerPos + new Vector3(0, 0, -Mathf.Abs(playerPos.y - platformGen.AvgPlatformHeight()));
        }

        //Freeze in place while respawn timer counts down
        if (PlayerController.GetCurrentHealth() <= 0 || respawnTimerValue > 0.0f)
        {
            respawnTimerValue -= Time.deltaTime;
        }
        else
        {
            frozen = false;
            playerCon.ToggleFreeze(false);
        }

        //Don't update score if frozen in place
        if (!frozen)
        {
            TickUpMultiplier();
            //tick up score, also sets coins
            AdjustScore((int)speedMultiplier);
        }

        //print debug stuff
        p("");
        p("Perfect jump multiplier: " + perfectJumpMultiplier);
        p("Speed multiplier: " + speedMultiplier.ToString("F2"));
        p("Vertical axis: " + Input.GetAxisRaw("Vertical").ToString("F2"));
    }