namespace VRTK.Prefabs.Locomotion.Movement.AxesToVector3 { using UnityEngine; using Malimbe.XmlDocumentationAttribute; /// /// Caches data and emits an appropriate event when the cache is updated. /// public class Vector3Cache : MonoBehaviour { /// /// Emitted when the cached data is updated and has been modified to a new value. /// [DocumentedByXml] public AxesToVector3Facade.UnityEvent Modified = new AxesToVector3Facade.UnityEvent(); /// /// Emitted when the cached data is updated but the value is unmodified. /// [DocumentedByXml] public AxesToVector3Facade.UnityEvent Unmodified = new AxesToVector3Facade.UnityEvent(); /// /// The cached data. Emits an event when the data changes based on whether the cache has changed from it's previous value. /// public Vector3 CachedData { get { return cachedData; } set { if (value == cachedData) { Unmodified?.Invoke(value); } else { Modified?.Invoke(value); } cachedData = value; } } private Vector3 cachedData; } }