namespace Zinnia.Tracking.Follow.Event.Proxy { using System; using UnityEngine; using UnityEngine.Events; using Zinnia.Event.Proxy; using Zinnia.Extension; public class ObjectFollowerEventProxyEmitter : RestrictableSingleEventProxyEmitter { /// /// Defines the event with the specified state. /// [Serializable] public class UnityEvent : UnityEvent { } /// /// The types of that can be used for the rule source. /// public enum RuleSourceType { /// /// Use the for the rule. /// Source, /// /// Use the for the rule. /// Target, /// /// Use the for the rule. /// TargetOffset } [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; } } /// /// Sets the . /// /// The index of the . public virtual void SetRuleSource(int index) { RuleSource = EnumExtensions.GetByIndex(index); } /// protected override object GetTargetToCheck() { switch (RuleSource) { case RuleSourceType.Source: return Payload.EventSource.gameObject; case RuleSourceType.Target: return Payload.EventTarget.gameObject; case RuleSourceType.TargetOffset: return Payload.EventTargetOffset.gameObject; default: return null; } } } }