/// <summary> /// Registers a feedback receiver so it will be notified when new feedback is available. /// </summary> /// <param name="receiver">The receiver to register.</param> public void RegisterReceiver(IVelocityFeedbackReceiver receiver) { if (!this.velReceivers.Contains(receiver)) { this.velReceivers.Add(receiver); } }
/// <summary> /// Unregisters a feedback receiver so it will not be notified when new feedback is available. /// </summary> /// <param name="receiver">The receiver to unregister.</param> public void UnregisterReceiver(IVelocityFeedbackReceiver receiver) { if (this.velReceivers.Contains(receiver)) { this.velReceivers.Remove(receiver); } }
/// <inheritdoc/> public void NotifyPositionFeedback(FeedbackData <Vector3> data) { if ((this.previousData != null) && (data.TimeStamp <= this.previousData.Value.TimeStamp)) { return; } FeedbackData <Vector3>?velocityFeedback = this.CalculateVelocityFeedback(data); if (velocityFeedback != null) { for (int index = 0; index < this.velReceivers.Count; index++) { IVelocityFeedbackReceiver receiver = this.velReceivers[index]; receiver.NotifyVelocityFeedback(velocityFeedback.Value); } } this.previousData = data; }