コード例 #1
0
        public void AddActionToHandleListener(DynamicActionEvent dynamicActionEvent)
        {
            //TODO add more complex way to take actions
            ActionAnswer        actionAnswer        = dynamicActionEvent.ActionAnswers[0];
            ActionResponseEvent actionResponseEvent = new ActionResponseEvent(dynamicActionEvent, actionAnswer);

            _eventBus.Post(actionResponseEvent);
        }
コード例 #2
0
        public void MoveInListener(MoveInEvent moveInEvent)
        {
            long index = _grid.GetNodeIndex(moveInEvent.Current);

            if (!_chests.Contains(index))
            {
                return;
            }
            _chests.Remove(index);

            Action action = new Action(_actionDefinition);

            action.AddParam("gold", 1500);

            DynamicActionEvent dynamicActionEvent = new DynamicActionEvent(action, _actionAnswers, moveInEvent.MoveToNextEvent.Owner);

            _eventBus.Post(dynamicActionEvent);
            Debug.WriteLine("Chest Taken");
        }
コード例 #3
0
        public void MoveInListener(MoveInEvent moveInEvent)
        {
            long index = _grid.GetNodeIndex(moveInEvent.Current);

            if (!_habitats.Contains(index))
            {
                return;
            }

            Habitat habitat = _nodeToEntityLinker[index].GetComponent <Habitat>();
            Action  action  = new Action(_actionDefinition);

            action.AddParam("population", habitat.Current);
            action.AddParam("habitat", habitat);

            DynamicActionEvent dynamicActionEvent =
                new DynamicActionEvent(action, _actionAnswers, moveInEvent.MoveToNextEvent.Owner);

            _eventBus.Post(dynamicActionEvent);
            Debug.WriteLine("Recruitment Start");
        }
コード例 #4
0
 public void AddActionToHandleListener(DynamicActionEvent dynamicActionEvent)
 {
     _onGoingActions.Add(dynamicActionEvent.Id, dynamicActionEvent);
 }
コード例 #5
0
 public FinishActionBlocker(DynamicActionEvent actionToFinish)
 {
     ActionToFinish = actionToFinish;
 }