Esempio n. 1
0
    public void UpdateFOVToPlayerSpeed()
    {
        float step      = config.fovSpeed * Time.deltaTime;
        float targetFOV = CurveUtil.NormalizedSample(
            config.FOVCurve,
            player.GetVelocity(),
            0.025f,
            difficulty.maxSpeedMultiplier * difficulty.baseSpeed,
            config.minFOV,
            config.maxFOV);

        target  = new Vector2(targetFOV, 0);
        current = new Vector2(cam.fieldOfView, 0);
        result  = Vector3.MoveTowards(current, target, step);

        cam.fieldOfView = result.x;
    }