예제 #1
0
        public override void Execute(Grid p_grid)
        {
            m_allSatisfied = (m_conditions.Count > 0);
            foreach (ObjectCondition objectCondition in m_conditions)
            {
                InteractiveObject interactiveObject = p_grid.FindInteractiveObject(objectCondition.id);
                if (interactiveObject == null)
                {
                    m_allSatisfied = false;
                    break;
                }
                if (interactiveObject.State != objectCondition.wantedState)
                {
                    m_allSatisfied = false;
                    break;
                }
            }
            EInteractionTiming einteractionTiming = EInteractionTiming.ON_FAIL;

            if (m_allSatisfied)
            {
                einteractionTiming = EInteractionTiming.ON_SUCCESS;
            }
            for (Int32 i = 0; i < Commands.Count; i++)
            {
                SpawnCommand spawnCommand = Commands[i];
                if ((spawnCommand.Timing == einteractionTiming || spawnCommand.Timing == EInteractionTiming.ON_EXECUTE) && (spawnCommand.ActivateCount == -1 || spawnCommand.ActivateCount > 0))
                {
                    BaseInteraction baseInteraction = InteractionFactory.Create(this, spawnCommand, SpawnerID, i);
                    if (baseInteraction.Valid && (spawnCommand.RequiredState == EInteractiveObjectState.NONE || StateIsMatching(spawnCommand, baseInteraction)))
                    {
                        Interactions.Add(baseInteraction);
                    }
                }
                m_stateMachine.ChangeState(EState.IDLE);
            }
            if (einteractionTiming == EInteractionTiming.ON_SUCCESS && QuestObjectives != null && QuestObjectives.Count > 0)
            {
                LegacyLogic.Instance.WorldManager.QuestHandler.ObjectInteraction(this);
            }
        }
예제 #2
0
 public override void OnAfterExecute(EInteractionTiming p_success)
 {
     m_stateMachine.ChangeState(EState.FINISHED);
 }