public void UnRegistEvent(IActionTrigger actionTrigger) { bool deleteKey = false; string deleteKeyName = ""; foreach (var eventName in eventDic.Keys) { var triggerList = eventDic[eventName]; if (triggerList.Contains(actionTrigger)) { triggerList.Remove(actionTrigger); if (triggerList.Count <= 0) { ListPool <IActionTrigger> .Release(triggerList); deleteKey = true; deleteKeyName = eventName; } break; } } if (deleteKey) { eventDic.Remove(deleteKeyName); } }
private void AddToRegistedTriggers(IActionTrigger trigger) { if (registedTriggers == null) { registedTriggers = ListPool <IActionTrigger> .Get(); } registedTriggers.Add(trigger); }
/// <summary> /// Adds a trigger to action. /// </summary> /// <param name="trigger"></param> public void AddTrigger(IActionTrigger trigger) { lock (triggers) { triggers.Add(trigger); trigger.BindTo(this); trigger.Initialize(mapping.InputProvider, true); } }
public static InteractionWaypoint CreateWaypoint( IInteractor expectedInteractor, IActionTrigger trigger, Vector3 position) { InteractionWaypoint waypointHolder = new GameObject("New Waypoint").AddComponent <InteractionWaypoint>(); waypointHolder.transform.position = position; waypointHolder.expectedInteractor = expectedInteractor; waypointHolder.SetTrigger(trigger); return(waypointHolder); }
/// <summary> /// Default ctor /// </summary> public TriggerItem(IActionTrigger trigger) { this.trigger = trigger; Text = trigger.Name; foreach (var action in trigger) { Nodes.Add(new ActionItem(action)); } ExpandAll(); }
/// <summary> /// Removes trigger from action. /// </summary> /// <param name="trigger"></param> public void RemoveTrigger(IActionTrigger trigger) { lock (triggers) { if (triggers.Remove(trigger)) { trigger.Initialize(mapping.InputProvider, false); trigger.BindTo(null); } } }
public void SetCookies(IEnumerable <string> cookies) { notNullReference.Check(cookies, "cookies"); actionLayer = cookies.ElementAt(0).Parse <DungeonSpawnConfig.ActionLayer>(); triggerCondition = cookies.ElementAt(1).Parse <DungeonSpawnConfig.ActionTriggerCondition>(); waitTime = Convert.ToSingle(cookies.ElementAt(2)); skillId = new SkillId(cookies.ElementAt(3)); eventId = Convert.ToInt32(cookies.ElementAt(4)); waveOrder = Convert.ToInt32(cookies.ElementAt(5)); actionTrigger = GenerateActionTrigger(); }
public void RegistEvent(string eventName, IActionTrigger actionTrigger) { if (!eventDic.ContainsKey(eventName)) { eventDic.Add(eventName, ListPool <IActionTrigger> .Get()); } var triggerList = eventDic[eventName]; if (!triggerList.Contains(actionTrigger)) { triggerList.Add(actionTrigger); } }
/// <summary> /// Default ctor /// </summary> internal ActionTriggerState(IActionTrigger entity, RailwayState railwayState) : base(railwayState) { actions = entity.Select(x => x.Accept(Default <StateBuilder> .Instance, railwayState)).Cast <IActionState>().ToList(); }
public void SetTrigger(IActionTrigger trigger) { this.trigger = trigger; Subscribe(); }
void IActionTriggerable.Trigger(IActionTrigger trigger, float stateData) { Trigger(stateData); }