// Copyright (c) 2015 - 2023 Doozy Entertainment. All Rights Reserved. // This code can only be used under the standard Unity Asset Store End User License Agreement // A Copy of the EULA APPENDIX 1 is available at http://unity3d.com/company/legal/as_terms using UnityEngine; namespace Doozy.Runtime.Signals { /// Object containing a value (or reference), used by the Signals system /// Signal value type public class MetaSignal : Signal { public T value { get; private set; } /// Create a MetaSignal public MetaSignal() : base(null, true, typeof(T)) { SetSignalValue(default); } /// Create a MetaSignal and set a reference to the GameObject from where it is sent /// Reference to the SignalStream this Signal is sent through /// Reference to the GameObject from where this Signal is sent internal MetaSignal(SignalStream stream, GameObject signalSource) : base(stream, signalSource, true, typeof(T)) { SetSignalValue(default); } /// Create a MetaSignal and set a reference to the SignalProvider that sends it /// Reference to the SignalStream this Signal is sent through /// Reference to the SignalProvider that sends this Signal internal MetaSignal(SignalStream stream, SignalProvider signalProvider) : base(stream, signalProvider, true, typeof(T)) { SetSignalValue(default); } /// Create a MetaSignal and set a reference to the Object that sends it /// Reference to the SignalStream this Signal is sent through /// Reference to the Object that sends this Signal internal MetaSignal(SignalStream stream, Object senderObject) : base(stream, senderObject, true, typeof(T)) { SetSignalValue(default); } internal void SetSignalValue(T signalValue) { this.SetValueType(true, typeof(T)); value = signalValue; valueAsObject = signalValue; } internal void ResetValue() { hasValue = false; valueType = null; value = default; valueAsObject = null; } } }