示例#1
0
        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);
            }
        }
示例#2
0
 private void AddToRegistedTriggers(IActionTrigger trigger)
 {
     if (registedTriggers == null)
     {
         registedTriggers = ListPool <IActionTrigger> .Get();
     }
     registedTriggers.Add(trigger);
 }
示例#3
0
 /// <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);
     }
 }
示例#4
0
        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();
        }
示例#6
0
 /// <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();
        }
示例#8
0
        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);
            }
        }
示例#9
0
 /// <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();
 }
示例#10
0
 public void SetTrigger(IActionTrigger trigger)
 {
     this.trigger = trigger;
     Subscribe();
 }
示例#11
0
 void IActionTriggerable.Trigger(IActionTrigger trigger, float stateData)
 {
     Trigger(stateData);
 }