namespace Zinnia.Tracking.Collision.Active.Event.Proxy { using System; using UnityEngine; using UnityEngine.Events; using Zinnia.Event.Proxy; using Zinnia.Extension; using Zinnia.Tracking.Collision.Active; /// /// Emits a UnityEvent with a payload whenever the Receive method is called. /// public class ActiveCollisionPublisherEventProxyEmitter : RestrictableSingleEventProxyEmitter { /// /// The types of that can be used for the rule source. /// public enum RuleSourceType { /// /// Use the for the rule. /// SourceContainer, /// /// Use the for the rule. /// PublisherContainer } [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 { } /// /// Sets the . /// /// The index of the . public virtual void SetRuleSource(int index) { RuleSource = EnumExtensions.GetByIndex(index); } /// protected override object GetTargetToCheck() { switch (RuleSource) { case RuleSourceType.PublisherContainer: return Payload?.PublisherContainer; case RuleSourceType.SourceContainer: return Payload?.SourceContainer; } return null; } } }