using NodeCanvas.Framework; using ParadoxNotion; using ParadoxNotion.Design; using ParadoxNotion.Services; namespace NodeCanvas.Tasks.Actions { [Category("✫ Utility")] [Description("Send a graph event. If global is true, all graph owners in scene will receive this event. Use along with the 'Check Event' Condition")] public class SendEvent : ActionTask { [RequiredField] public BBParameter eventName; public BBParameter delay; public bool sendGlobal; protected override string info { get { return ( sendGlobal ? "Global " : "" ) + "Send Event [" + eventName + "]" + ( delay.value > 0 ? " after " + delay + " sec." : "" ); } } protected override void OnUpdate() { if ( elapsedTime >= delay.value ) { if ( sendGlobal ) { Graph.SendGlobalEvent(eventName.value, null, this); } else { agent.SendEvent(eventName.value, null, this); } EndAction(); } } } ///---------------------------------------------------------------------------------------------- [Category("✫ Utility")] [Description("Send a graph event with T value. If global is true, all graph owners in scene will receive this event. Use along with the 'Check Event' Condition")] public class SendEvent : ActionTask { [RequiredField] public BBParameter eventName; public BBParameter eventValue; public BBParameter delay; public bool sendGlobal; protected override string info { get { return string.Format("{0} Event [{1}] ({2}){3}", ( sendGlobal ? "Global " : "" ), eventName, eventValue, ( delay.value > 0 ? " after " + delay + " sec." : "" )); } } protected override void OnUpdate() { if ( elapsedTime >= delay.value ) { if ( sendGlobal ) { Graph.SendGlobalEvent(eventName.value, eventValue.value, this); } else { agent.SendEvent(eventName.value, eventValue.value, this); } EndAction(); } } } }