// ---------------------------------------------------------------------------- // Unite 2017 - Game Architecture with Scriptable Objects // // Author: Ryan Hipple // Date: 10/04/17 // ---------------------------------------------------------------------------- /****************************************************************************** * Note from me: * If you have not watched this presentation, drop everything and watch it now * https://youtu.be/raQ3iHhE_Kk * * YOU MUST MASTER THIS CONTENT! *****************************************************************************/ using System; namespace Architecture.Variables { [Serializable] public class FloatReference { public bool UseConstant = true; public float ConstantValue; public FloatVariable Variable; public FloatReference() { } public FloatReference(float value) { UseConstant = true; ConstantValue = value; } public float Value { get { return UseConstant ? ConstantValue : Variable.Value; } } public static implicit operator float(FloatReference reference) { return reference.Value; } } }