using System;
namespace LobbyRelaySample
{
///
/// In your Observed children, be sure to call OnChanged when setting the value of any property.
///
/// The Data we want to view.
public abstract class Observed
{
///
/// If you want to copy all of the values, and only trigger OnChanged once.
///
///
public abstract void CopyObserved(T oldObserved);
public Action onChanged { get; set; }
public Action onDestroyed { get; set; }
///
/// Should be implemented into every public property of the observed
///
/// Instance of the observed that changed.
protected void OnChanged(T observed)
{
onChanged?.Invoke(observed);
}
protected void OnDestroy(T observed)
{
onDestroyed?.Invoke(observed);
}
}
}