如何在 Unity C# 中检测浮点变量是否增加了 10?

How to detect if a float variable has raised up by 10 in Unity C#?

我正在 Unity3D 中制作跑酷游戏,我想检测每次距离(浮点变量)增加 10 以提高速度一点点,这可能吗??? 提前致谢:)

好吧,感谢@mjwills,很快找到了解决方案!!! 这是代码:

using System.Collections;
using UnityEngine;

public class GameManager : SingleTon<GameManager> {

    private float oldDis;

    void Start()
    {
        oldDis = distance;
    }

    // Update is called once per frame
    void Update ()
    {

        if (distance - oldDis >= 10)
        {
            Debug.Log("Raised up by 10 and now it's " + distance + " !!!");
            oldDis = distance;
        } 
    }

}