Exemple #1
0
    void FixedUpdate()
    {
        if (logRotateVel > logVelEpsilon)
        {
            float deltaTime = TimeManager.Current.FixedDeltaTimeExceptHero;

            float actualVelocity = Mathf.Exp(logRotateVel) * deltaTime;
            kuruma.Rotate(0, 0, -actualVelocity);

            if (IsRotatingEnough)
            {
                float velFirst = rotateVelPerSecFirst * deltaTime;
                mat.SetFloat("_Volume", actualVelocity / velFirst * edgeLightVolMax);
            }

            float tmpNextVel = logRotateVel - logVelDecay * deltaTime;

            if (logRotateVel >= logVelThreshold && tmpNextVel < logVelThreshold)
            {
                mat.SetFloat("_Volume", 0);
                OnSlow?.Invoke(this, EventArgs.Empty);
            }

            logRotateVel = tmpNextVel;
        }
    }
 private void _OnSlow()
 {
     slow = true;
     OnSlow?.Invoke(this, EventArgs.Empty);
 }