예제 #1
0
파일: UiActionBag.cs 프로젝트: rphuang/riot
        /// <summary>
        /// take and execute one action from the ConcurrentBag if any item exist
        /// </summary>
        public ActionDef TryExecuteAction()
        {
            ActionDef action;

            if (UiActions.TryTake(out action))
            {
                action.ActionService.Act(action.ActionData);
            }
            return(action);
        }
예제 #2
0
파일: UiActionBag.cs 프로젝트: rphuang/riot
        /// <summary>
        /// take and execute all actions from the ConcurrentBag if any item exist
        /// </summary>
        public bool TryExecuteActions()
        {
            int count = 0;

            while (UiActions.Count > 0)
            {
                ActionDef action;
                if (UiActions.TryTake(out action))
                {
                    action.ActionService.Act(action.ActionData);
                    count++;
                }
            }
            return(count > 0);
        }