/// <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); } } } }
public override TimedThumpCmd Copy(bool copyElapsed = true) { float el = copyElapsed ? this.elapsedTime : 0; ThumperWaveForm form = new ThumperWaveForm(this.maxAmplitude, this.duration, this._timeline, el); form.magnitude = this.magnitude; return(form); }