コード例 #1
0
    private void onCollectingCompleted(GatheredMaterialConcept gatheredConcept, AgentMessage message)
    {
        AgentMessage reply = message.Reply(AgentMessage.PerformativeType.INFORM);

        reply.Content = gatheredConcept;
        Send(reply);
    }
コード例 #2
0
    private void processGetMaterialActionRequest(AgentMessage message)
    {
        Action <GatheredMaterialConcept> actionOnCollectingCompleted = getActionOnCollectingCompleted(message);

        RPGAgentToolkit.Core.Behaviour behaviour = getCollectingBehaviour(message, actionOnCollectingCompleted);
        AddBehaviour(behaviour);

        AgentMessage reply = message.Reply(AgentMessage.PerformativeType.AGREE);

        Send(reply);
    }
コード例 #3
0
    private void processCancelMaterialActionRequest(AgentMessage message)
    {
        GetMaterialAction action = message.Content as GetMaterialAction;

        MaterialConcept.MaterialType materialType = action.GetMaterial().GetMaterialType();
        if (materialType == MaterialConcept.MaterialType.Wood)
        {
            behaviours.FindAll(it => it.GetType() == typeof(CollectWoodBehaviour)).ForEach(it => it.Stop());
        }
        else if (materialType == MaterialConcept.MaterialType.Stone)
        {
            behaviours.FindAll(it => it.GetType() == typeof(CollectStoneBehaviour)).ForEach(it => it.Stop());
        }
        AgentMessage reply = message.Reply(AgentMessage.PerformativeType.INFORM);

        reply.Content = new CancelledJobConcept();
        Send(reply);
    }