using System;

namespace OctreeRendering
{
    class Eventful<T>
    {
        T value;
        public event Action Changed = ActionHelper.NullAction;

        public T Value
        {
            get { return value; }
        }

        public void Set(T newValue)
        {
            value = newValue;
            Changed();
        }

        public static implicit operator T(Eventful<T> eventful)
        {
            return eventful.Value;
        }
        public static implicit operator Eventful<T>(T value)
        {
            return new Eventful<T> { value = value };
        }

        public override string ToString()
        {
            return value.ToString();
        }
    }
}
