namespace Zinnia.Event.Proxy { using System; using UnityEngine; using UnityEngine.Events; using Zinnia.Data.Collection.List; /// /// Emits a with a payload whenever the method is called. /// public class GameObjectRelationEventProxyEmitter : RestrictableSingleEventProxyEmitter { /// /// The types of that can be used for the rule source. /// public enum RuleSourceType { /// /// Use the Relation Key as the source for the rule. /// Key, /// /// Use the Relation Value as the target for the rule. /// Value } [Tooltip("The source GameObject to apply to the RestrictableSingleEventProxyEmitter.ReceiveValidity.")] [SerializeField] private RuleSourceType ruleSource; /// /// The source to apply to the . /// public RuleSourceType RuleSource { get { return ruleSource; } set { ruleSource = value; } } /// /// Defines the event with the specified state. /// [Serializable] public class UnityEvent : UnityEvent { } /// protected override object GetTargetToCheck() { switch (RuleSource) { case RuleSourceType.Key: return Payload != null ? Payload?.Key : null; case RuleSourceType.Value: return Payload != null ? Payload?.Value : null; } return null; } } }