コード例 #1
0
    public void SetBrakeBuzz(int[] ffb, int[] buzz)
    {
        if (CanTestBuzzMotors && CanTestFFB)
        {
            int[] FFBcmd = FFBLvls;
            for (int f = 0; f < 5 && f < ffb.Length; f++) //ensures it works even if levels is not large enough
            {
                FFBcmd[f] = Mathf.Clamp(ffb[f], 0, 100);
            }
            FFBLvls = FFBcmd; //updates latest

            int[] buzzCmd = BuzzMotorLvls;
            for (int f = 0; f < 5 && f < buzz.Length; f++) //ensures it works even if levels is not large enough
            {
                buzzCmd[f] = Mathf.Clamp(buzz[f], 0, 100);
            }
            BuzzMotorLvls = buzzCmd; //updates latest

            SenseGlove iGlove = (SenseGlove)senseGlove.GetInternalObject();
            if (iGlove != null)
            {
                iGlove.SendBrakeBuzz(FFBcmd, buzzCmd);
            }
            else
            {
                Debug.Log("Could not send commands because we have no Glove");
            }
        }
    }