Esempio n. 1
0
    private IEnumerator Run()
    {
        if (lightOnReasonedLastCycle && !reasoning)
        {
            reasoning = true;
            Reasoner r = agLightOff.GetReasoner();
            textMeshS.text = agLightOff.GetName() + ": Voy a percibir mi entorno";
            Dictionary <string, string> p = r.Perceive();
            yield return(new WaitForSeconds(3));

            textMeshS.text = agLightOff.GetName() + ": Voy a actualizar mi base de creencias";
            r.UpdateBeliefs(p);
            //Desire d = ag.SelectDesire();
            yield return(new WaitForSeconds(3));

            textMeshS.text = agLightOff.GetName() + ": Voy a seleccionar un plan";
            Plan i = r.SelectPlan();
            yield return(new WaitForSeconds(3));

            textMeshS.text = agLightOff.GetName() + ": Voy a actuar";
            r.Act(i);
            lightOnReasonedLastCycle = false;
            reasoning = false;
        }
        else if (!lightOnReasonedLastCycle && !reasoning)
        {
            reasoning = true;
            Reasoner r = agLightOn.GetReasoner();
            textMeshS.text = agLightOn.GetName() + ": Voy a percibir mi entorno";
            Dictionary <string, string> p = r.Perceive();
            yield return(new WaitForSeconds(3));

            textMeshS.text = agLightOn.GetName() + ": Voy a actualizar mi base de creencias";
            r.UpdateBeliefs(p);
            //Desire d = ag.SelectDesire();
            yield return(new WaitForSeconds(3));

            textMeshS.text = agLightOn.GetName() + ": Voy a seleccionar un plan";
            Plan i = r.SelectPlan();
            yield return(new WaitForSeconds(3));

            textMeshS.text = agLightOn.GetName() + ": Voy a actuar";
            r.Act(i);
            lightOnReasonedLastCycle = true;
            reasoning = false;
        }
    }