/// <summary> Send a vibration command based on an AnimationCurve. With optional override parameters. </summary> /// <param name="buzz"></param> /// <param name="overrideFingers"></param> /// <param name="magnitude"></param> /// <param name="duration_s"></param> public virtual void SendCmd(SG_Waveform buzz, bool[] overrideFingers, int magnitude, float duration_s) { if (this.isActiveAndEnabled && this.lastGlove != null && buzz != null) { if (buzz.wrist && this.DeviceType != SGCore.DeviceType.SENSEGLOVE) { //Debug.Log("Converted a Waveform into a thumper cmd"); ThumperWaveForm cmd = new ThumperWaveForm(magnitude, duration_s, buzz.waveForm, -Time.deltaTime); this.thumperQueue.Add(cmd); if (this.thumperQueue.Count > maxQueue) { thumperQueue.RemoveAt(0); } } else { //Debug.Log("Converted a Waveform into a buzzCmd"); SG_WaveFormCmd iCmd = new SG_WaveFormCmd(buzz.waveForm, duration_s, magnitude, overrideFingers, -Time.deltaTime); this.buzzQueue.Add(((SGCore.Haptics.SG_TimedBuzzCmd)iCmd.Copy())); if (this.buzzQueue.Count > maxQueue) { buzzQueue.RemoveAt(0); } } } }
/// <summary> A deeop copy of this commmand. </summary> /// <returns></returns> public override SG_BuzzCmd Copy() { SG_WaveFormCmd res = new SG_WaveFormCmd(this._timeline, 0, this._amplitude, this._fingers, 0); res.elapsedTime = this.elapsedTime; res.duration = this.duration; return(res); }