Exemplo n.º 1
0
    void Update()
    {
        velocity = DialControl.Velocity();

        if (started == 0 && velocity != 0)
        {
            started = 1;
        }

        if (started == 1)
        {
            if (velocity != 0)
            {
                values.Add(velocity);
            }
            else
            {
                started = 2;
                for (int i = 0; i < values.Count; i++)
                {
                    average += values[i];
                }
                average /= values.Count;
            }
        }

        if (started == 2)
        {
            //TODO :: Do something
        }
    }
Exemplo n.º 2
0
    public static float Acceleration()
    {
        float acceleration = (DialControl.Velocity() - lastVel) / Time.deltaTime;

        lastVel = DialControl.Velocity();
        return(acceleration);
    }