Пример #1
0
    public static void executeOperation(ActionNode action, Agent agt)
    {
        PrintSingleton.Instance.log("Executing " + action.name + " by " + agt.name);
        ProceduralBehavior proceduralBehavior = (ProceduralBehavior)(agt.getBehaviorExecutingByName("ProceduralBehavior"));

        for (int iP = 0; iP < proceduralBehavior.runningProcedures.Count; iP++)
        {
            ProcedureExecution procInfo = proceduralBehavior.runningProcedures[iP];
            action.start(agt, procInfo.getAffectations(), false);
            proceduralBehavior.sendActionRealisationMessage(action, procInfo);
            procInfo.informActionRunning(agt.Aid, action);

            if (action.CurrentExecution != null)
            {
                proceduralBehavior.BehaviorToNode.Add(action.CurrentExecution, action);
                action.CurrentExecution.addCallbackOnBehaviorStop(onBehaviorStop);
            }
            else
            {
                procInfo.informActionDone(agt.Aid, action);
                proceduralBehavior.sendActionDoneMessage(action, procInfo);
            }
        }
    }