public void HandleEffects(List <Name> _events)
    {
        Player.Perceive(_events);
        _agentController.RPC.Perceive(_events);
        _agentController.UpdateEmotionExpression();

        if (_wm != null)
        {
            var effects = _wm.Simulate(_events.ToArray());

            foreach (var eff in effects)
            {
                //     Debug.Log("Effect: " + eff.PropertyName + " " + eff.NewValue + " " + eff.ObserverAgent);
                if (eff.ObserverAgent.ToString() == "Player")
                {
                    Player.Perceive(EventHelper.PropertyChange(eff.PropertyName, eff.NewValue, (Name)"World"));
                }
                else if (eff.ObserverAgent.ToString() == _agentController.RPC.CharacterName.ToString())
                {
                    _agentController.RPC.Perceive(EventHelper.PropertyChange(eff.PropertyName, eff.NewValue, (Name)"World"));
                }

                else if (eff.ObserverAgent.IsUniversal)
                {
                    Player.Perceive(EventHelper.PropertyChange(eff.PropertyName, eff.NewValue, (Name)"World"));
                    _agentController.RPC.Perceive(EventHelper.PropertyChange(eff.PropertyName, eff.NewValue, (Name)"World"));
                }
            }
        }
    }
Beispiel #2
0
    private void HandleSpeakAction(Guid id, string subject, string target)
    {
        var d = iat.GetDialogActionById(id);

        var dAct = string.Format("Speak({0},{1},{2},{3})", d.CurrentState, d.NextState, d.Meaning, d.Style);

        agent1RPC.Perceive(EventHelper.ActionEnd(subject, dAct, target));
        playerRPC.Perceive(EventHelper.ActionEnd(subject, dAct, target));

        var dStatePropertyAgent  = string.Format(IATConsts.DIALOGUE_STATE_PROPERTY, IATConsts.PLAYER);
        var dStatePropertyPlayer = string.Format(IATConsts.DIALOGUE_STATE_PROPERTY, agent1RPC.CharacterName.ToString());

        agent1RPC.Perceive(EventHelper.PropertyChange(dStatePropertyAgent, d.NextState, subject));
        playerRPC.Perceive(EventHelper.PropertyChange(dStatePropertyPlayer, d.NextState, subject));

        agent1RPC.Perceive(EventHelper.PropertyChange("Has(Floor)", target, subject));
        playerRPC.Perceive(EventHelper.PropertyChange("Has(Floor)", target, subject));

        if (SaveLog)
        {
            this.SaveState();
        }

        playerDialogues = DeterminePlayerDialogues();
        UpdatePlayerDialogOptions(true);
    }
Beispiel #3
0
    public void GetCharacterResponse()
    {
        CurrentCharacter.Perceive(_events);
        var possibleActions = CurrentCharacter.Decide();
        var action          = RolePlayCharacterAsset.TakeBestActions(possibleActions).FirstOrDefault();

        _events.Clear();
        CurrentCharacter.Update();

        if (action != null)
        {
            var actionKey = action.Key.ToString();
            if (actionKey == "Speak")
            {
                var nextState         = action.Parameters[1];
                var dialogues         = _integratedAuthoringTool.GetDialogueActionsByState(action.Parameters[0].ToString());
                var characterDialogue = dialogues.FirstOrDefault(dto => string.Equals(dto.Meaning.ToString(), action.Parameters[2].ToString(), StringComparison.CurrentCultureIgnoreCase) && string.Equals(dto.Style.ToString(), action.Parameters[3].ToString(), StringComparison.CurrentCultureIgnoreCase));
                if (characterDialogue != null)
                {
                    UpdateFeedbackScores(characterDialogue, "Client");
                    _events.Add((Name)string.Format("Event(Property-Change,{0},DialogueState(Player),{1})", CurrentCharacter.CharacterName, nextState));
                    UpdateCurrentState();
                    PlayDialogueAudio(characterDialogue.FileName);
                    GetCharacterDialogueSuccessEvent?.Invoke(Localization.GetAndFormat(characterDialogue.FileName, false, ScenarioCode));
                }
            }
        }

        GetCharacterStrongestEmotion();
    }
    public void HandleEffects(List <Name> _events)
    {
        foreach (var ev in _events)
        {
            _player.Perceive(ev);
            _agentControllers.ForEach(x => x.RPC.Perceive(ev));
        }

        if (_wm != null)
        {
            var effects = _wm.Simulate(_events.ToArray());


            foreach (var eff in effects)
            {
                Debug.Log("Effect: " + eff.PropertyName + " " + eff.NewValue + " " + eff.ObserverAgent);

                if (eff.ObserverAgent.ToString() == _player.CharacterName.ToString())
                {
                    _player.Perceive(EventHelper.PropertyChange(eff.PropertyName, eff.NewValue, (Name)"World"));
                }
                else if (eff.ObserverAgent.IsUniversal)
                {
                    _player.Perceive(EventHelper.PropertyChange(eff.PropertyName, eff.NewValue, (Name)"World"));
                    _agentControllers.ForEach(x => x.RPC.Perceive(EventHelper.PropertyChange(eff.PropertyName, eff.NewValue, (Name)"World")));
                }
                else
                {
                    {
                        _agentControllers.Find(x => x.RPC.CharacterName == eff.ObserverAgent).RPC.Perceive(EventHelper.PropertyChange(eff.PropertyName, eff.NewValue, (Name)"World"));
                    }
                }
            }
        }
    }
    private void PlayerReplyAction(string replyActionName, string nextState)
    {
        var events = new List <Name>();

        events.Add(EventHelper.ActionEnd(IATConsts.PLAYER, replyActionName, _agentController.RPC.CharacterName.ToString()));

        var effects = _wm.Simulate(events);

        foreach (var eff in effects)
        {
            var ef = eff.ToPropertyChangeEvent();

            if (eff.ObserverAgent == _agentController.RPC.CharacterName)
            {
                _agentController.AddEvent(ef);
            }
            else if (eff.ObserverAgent == Player.CharacterName)
            {
                Player.Perceive(ef);
            }
            else
            {
                _agentController.AddEvent(ef);
                Player.Perceive(ef);
            }
        }

        _agentController.canSpeak = true;
        waitingForReply           = true;
    }
        private IEnumerator UpdateCoroutine()
        {
            _events.Clear();
            while (m_rpc.GetBeliefValue(string.Format(IATConsts.DIALOGUE_STATE_PROPERTY, IATConsts.PLAYER)) != IATConsts.TERMINAL_DIALOGUE_STATE)
            {
                yield return(new WaitForSeconds(0.1f));

                if (_events.Count == 0)
                {
                    m_rpc.Update();
                    continue;
                }



                m_rpc.Perceive(_events);



                var action = m_rpc.Decide().FirstOrDefault();

                _events.Clear();
                m_rpc.Update();

                if (action == null)
                {
                    continue;
                }

                Debug.Log("Action Key: " + action.Key);

                if (canSpeak)
                {
                    switch (action.Key.ToString())
                    {
                    case "Speak":
                        m_activeController.StartCoroutine(HandleSpeak(action));
                        canSpeak = false;
                        break;

                    case "Disconnect":
                        m_activeController.StartCoroutine(newHandleDisconnect());
                        m_dialogController.AddDialogLine(string.Format("- {0} disconnects -", m_rpc.CharacterName));

                        _currentCoroutine = null;
                        Object.Destroy(_body.Body);
                        break;

                    default:
                        Debug.LogWarning("Unknown action: " + action.Key);
                        break;
                    }
                }
            }
        }
Beispiel #7
0
        public void UpdatePerception(RolePlayCharacterAsset rpc)
        {
            string b = rpc.GetBeliefValue("Entity(" + GUID + "," + Prefab + ")");

            if (b == null || !(b.Equals(Quantity.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("Entity(" + GUID + "," + Prefab + ")", Quantity.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("ChopWorkable(" + GUID + ")");
            if (b == null || !(b.Equals(ChopWorkable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("ChopWorkable(" + GUID + ")", ChopWorkable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("HammerWorkable(" + GUID + ")");
            if (b == null || !(b.Equals(HammerWorkable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("HammerWorkable(" + GUID + ")", HammerWorkable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("DigWorkable(" + GUID + ")");
            if (b == null || !(b.Equals(DigWorkable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("DigWorkable(" + GUID + ")", DigWorkable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("MineWorkable(" + GUID + ")");
            if (b == null || !(b.Equals(MineWorkable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("MineWorkable(" + GUID + ")", MineWorkable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("Pickable(" + GUID + ")");
            if (b == null || !(b.Equals(Pickable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("Pickable(" + GUID + ")", Pickable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("PosX(" + GUID + ")");
            if (b == null || !(b.Equals(X.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("PosX(" + GUID + ")", X.ToString(), rpc.CharacterName.ToString()));
            }

            /*
             * The Y-axis is always equal to zero, no need to save it in the knowledge base
             * */
            //b = rpc.GetBeliefValue("PosY(" + GUID + ")");
            //if ( b == null || !(b.Equals(Y.ToString())))
            //    rpc.Perceive(EventHelper.PropertyChange("PosY(" + GUID + ")", Y.ToString(), rpc.CharacterName.ToString()));

            b = rpc.GetBeliefValue("PosZ(" + GUID + ")");
            if (b == null || !(b.Equals(Z.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("PosZ(" + GUID + ")", Z.ToString(), rpc.CharacterName.ToString()));
            }
        }
Beispiel #8
0
        private void PerceiveActionEnd(RolePlayCharacterAsset rpc)
        {
            var e = EventHelper.ActionEnd(Subject, Name, Value);

            Debug.WriteLine(e.ToString());
            rpc.Perceive(e);
        }
Beispiel #9
0
 private void perceive(SuecaEvent ev)
 {
     //DEBUG
     //foreach (var el in ev.Events)
     //{
     //    Console.WriteLine(el.ToString());
     //}
     _rpc.Perceive(ev.Events);
 }
Beispiel #10
0
 private void perceive(SuecaEvent ev)
 {
     //DEBUG
     Console.WriteLine(_agentName + "---" + "Going to perceive event " + ev.Name);
     foreach (var el in ev.Events)
     {
         Console.WriteLine(_agentName + "---" + el.ToString());
     }
     _rpc.Perceive(ev.Events);
 }
Beispiel #11
0
        private void PerceivePropertyChanged(RolePlayCharacterAsset rpc)
        {
            /*
             * Update the KB with the new belief if it is different from the current belief
             * */
            string bv = rpc.GetBeliefValue(Name);

            if (bv == null || !bv.Equals(Value.ToString()))
            {
                Debug.WriteLine(Name + ": " + bv + " -> " + Value.ToString());
                rpc.Perceive(EventHelper.PropertyChange(Name, Value, Subject));
            }
        }
Beispiel #12
0
    private IEnumerator HandleDisconnectAction(IAction actionRpc)
    {
        yield return(null);

        m_rpc.Perceive(new Name[] { EventHelper.ActionEnd(m_rpc.CharacterName.ToString(), actionRpc.Name.ToString(), IATConsts.PLAYER) });
        if (_body)
        {
            _body.Hide();
        }
        yield return(new WaitForSeconds(2));

        GameObject.Destroy(GameObject.FindGameObjectWithTag("Score"));
        if (m_scenarioData.IAT.ScenarioName.Contains("PJ"))
        {
            _finalScore.SetActive(true);
            GameObject.FindGameObjectWithTag("FinalScoreText").GetComponent <FinalScoreScript>().FinalScore(RPC.Mood);
        }
    }
        public AgentControler(SingleCharacterDemo.ScenarioData scenarioData, RolePlayCharacterAsset rpc,
                              IntegratedAuthoringToolAsset iat, UnityBodyImplement archetype, Transform anchor, DialogController dialogCrt)
        {
            m_scenarioData     = scenarioData;
            m_iat              = iat;
            m_rpc              = rpc;
            m_dialogController = dialogCrt;
            _body              = GameObject.Instantiate(archetype);
            just_talked        = false;


            var t = _body.transform;

            t.SetParent(anchor, false);
            t.localPosition = Vector3.zero;
            t.localPosition = new Vector3(0.0f, -1.0f, 0.0f);
            t.localRotation = Quaternion.identity;
            t.localScale    = Vector3.one;
            m_dialogController.SetCharacterLabel(m_rpc.CharacterName.ToString());

            m_rpc.Perceive(new Name[] { EventHelper.PropertyChange("DialogueState(Player)", "Start", "world") });
        }
Beispiel #14
0
        public void UpdatePerception(RolePlayCharacterAsset rpc)
        {
            string b = rpc.GetBeliefValue("Entity(" + GUID + ")");

            if (b == null || !(b.Equals(Prefab.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("Entity(" + GUID + ")", Prefab.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("Quantity(" + GUID + ")");
            if (b == null || !(b.Equals(Quantity.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("Quantity(" + GUID + ")", Quantity.ToString(), rpc.CharacterName.ToString()));
            }

            //====================================================
            b = rpc.GetBeliefValue("IsCollectable(" + GUID + ")");
            if (b == null || !(b.Equals(IsCollectable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsCollectable(" + GUID + ")", IsCollectable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsCooker(" + GUID + ")");
            if (b == null || !(b.Equals(IsCooker.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsCooker(" + GUID + ")", IsCooker.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsCookable(" + GUID + ")");
            if (b == null || !(b.Equals(IsCookable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsCookable(" + GUID + ")", IsCookable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsEdible(" + GUID + ")");
            if (b == null || !(b.Equals(IsEdible.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsEdible(" + GUID + ")", IsEdible.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsEquippable(" + GUID + ")");
            if (b == null || !(b.Equals(IsEquippable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsEquippable(" + GUID + ")", IsEquippable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsFuel(" + GUID + ")");
            if (b == null || !(b.Equals(IsFuel.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsFuel(" + GUID + ")", IsFuel.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsFueled(" + GUID + ")");
            if (b == null || !(b.Equals(IsFueled.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsFueled(" + GUID + ")", IsFueled.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsGrower(" + GUID + ")");
            if (b == null || !(b.Equals(IsGrower.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsGrower(" + GUID + ")", IsGrower.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsHarvestable(" + GUID + ")");
            if (b == null || !(b.Equals(IsHarvestable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsHarvestable(" + GUID + ")", IsHarvestable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsPickable(" + GUID + ")");
            if (b == null || !(b.Equals(IsPickable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsPickable(" + GUID + ")", IsPickable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsStewer(" + GUID + ")");
            if (b == null || !(b.Equals(IsStewer.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsStewer(" + GUID + ")", IsStewer.ToString(), rpc.CharacterName.ToString()));
            }

            //==================================================
            b = rpc.GetBeliefValue("IsChoppable(" + GUID + ")");
            if (b == null || !(b.Equals(IsChoppable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsChoppable(" + GUID + ")", IsChoppable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsHammerable(" + GUID + ")");
            if (b == null || !(b.Equals(IsHammerable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsHammerable(" + GUID + ")", IsHammerable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsDiggable(" + GUID + ")");
            if (b == null || !(b.Equals(IsDiggable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsDiggable(" + GUID + ")", IsDiggable.ToString(), rpc.CharacterName.ToString()));
            }

            b = rpc.GetBeliefValue("IsMineable(" + GUID + ")");
            if (b == null || !(b.Equals(IsMineable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("IsMineable(" + GUID + ")", IsMineable.ToString(), rpc.CharacterName.ToString()));
            }

            //===========================================
            b = rpc.GetBeliefValue("PosX(" + GUID + ")");
            if (b == null || !(b.Equals(X.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("PosX(" + GUID + ")", X.ToString(), rpc.CharacterName.ToString()));
            }

            /*
             * The Y-axis is always equal to zero, no need to save it in the knowledge base
             * */

            b = rpc.GetBeliefValue("PosZ(" + GUID + ")");
            if (b == null || !(b.Equals(Z.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("PosZ(" + GUID + ")", Z.ToString(), rpc.CharacterName.ToString()));
            }
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            //AssetStorage
            var storage = AssetStorage.FromJson(File.ReadAllText("../../../../Examples/AssetStorage.json"));
            //Loading the asset
            var rpc = new RolePlayCharacterAsset();

            rpc.LoadAssociatedAssets(storage);
            rpc.ActivateIdentity(new Identity((Name)"Portuguese", (Name)"Culture", 1));
            Console.WriteLine("Starting Mood: " + rpc.Mood);
            var actions = rpc.Decide();
            var action  = actions.FirstOrDefault();

            rpc.Update();

            Console.WriteLine("The name of the character loaded is: " + rpc.CharacterName);
            // Console.WriteLine("The following event was perceived: " + event1);
            Console.WriteLine("Mood after event: " + rpc.Mood);
            Console.WriteLine("Strongest emotion: " + rpc.GetStrongestActiveEmotion()?.EmotionType + "-" + rpc.GetStrongestActiveEmotion()?.Intensity);
            Console.WriteLine("First Response: " + action?.Name + ", Target:" + action?.Target.ToString());

            var busyAction = rpc.Decide().FirstOrDefault();

            Console.WriteLine("Second Response: " + busyAction?.Name + ", Target:" + action?.Target.ToString());

            var event3 = EventHelper.ActionEnd(rpc.CharacterName.ToString(), action?.Name.ToString(), "Player");

            rpc.Perceive(new[] { event3 });
            action = rpc.Decide().FirstOrDefault();

            Console.WriteLine("Third Response: " + action?.Name + ", Target:" + action?.Target.ToString());


            int x = 0;

            while (true)
            {
                Console.WriteLine("Mood after tick: " + rpc.Mood + " x: " + x + " tick: " + rpc.Tick);
                Console.WriteLine("Strongest emotion: " + rpc.GetStrongestActiveEmotion()?.EmotionType + "-" + rpc.GetStrongestActiveEmotion()?.Intensity);
                rpc.Update();
                Console.ReadLine();

                if (x == 10)
                {
                    var event1 = EventHelper.ActionEnd("Player", "Kick", rpc.CharacterName.ToString());

                    rpc.Perceive(new[] { event1 });
                    action = rpc.Decide().FirstOrDefault();
                    rpc.Update();
                }


                if (x == 11)
                {
                    rpc.ResetEmotionalState();
                }
                if (x == 25)
                {
                    var event1 = EventHelper.ActionEnd("Player", "Kick", rpc.CharacterName.ToString());

                    rpc.Perceive(new[] { event1 });
                    action = rpc.Decide().FirstOrDefault();
                    rpc.Update();
                }


                else if (x == 30)
                {
                    Console.WriteLine("Reloading " + rpc.GetStrongestActiveEmotion().Intensity + " " + rpc.GetStrongestActiveEmotion().EmotionType + " mood: " + rpc.Mood);

                    Console.WriteLine("Reloading result: " + rpc.GetStrongestActiveEmotion().Intensity + " " + rpc.GetStrongestActiveEmotion().EmotionType + " mood: " + rpc.Mood);
                }

                x++;
            }
        }
Beispiel #16
0
 public void Perceive(Name[] events)
 {
     rpc.Perceive(events);
 }
Beispiel #17
0
        public void UpdatePerceptions(RolePlayCharacterAsset rpc)
        {
            /*
             * Find every InSight, InInventory, and IsEquipped belief and set them to false
             * */
            CleanBeliefs(rpc);

            /*
             * Update the KB with the new beliefs
             * */
            string bv = rpc.GetBeliefValue("Hunger(" + rpc.CharacterName.ToString() + ")");

            if (bv == null || !bv.Equals(Hunger.ToString()))
            {
                Debug.WriteLine("Hunger: " + bv + " -> " + Hunger.ToString());
                rpc.Perceive(EventHelper.PropertyChange("Hunger(" + rpc.CharacterName.ToString() + ")", Hunger.ToString(), rpc.CharacterName.ToString()));
            }

            bv = rpc.GetBeliefValue("Health(" + rpc.CharacterName.ToString() + ")");
            if (bv == null || !bv.Equals(Health.ToString()))
            {
                Debug.WriteLine("Health: " + bv + " -> " + Health.ToString());
                rpc.Perceive(EventHelper.PropertyChange("Health(" + rpc.CharacterName.ToString() + ")", Health.ToString(), rpc.CharacterName.ToString()));
            }

            bv = rpc.GetBeliefValue("Sanity(" + rpc.CharacterName.ToString() + ")");
            if (bv == null || !bv.Equals(Sanity.ToString()))
            {
                Debug.WriteLine("Sanity: " + bv + " -> " + Sanity.ToString());
                rpc.Perceive(EventHelper.PropertyChange("Sanity(" + rpc.CharacterName.ToString() + ")", Sanity.ToString(), rpc.CharacterName.ToString()));
            }

            bv = rpc.GetBeliefValue("IsFreezing(" + rpc.CharacterName.ToString() + ")");
            if (bv == null || !bv.Equals(IsFreezing.ToString()))
            {
                Debug.WriteLine("IsFreezing: " + bv + " -> " + IsFreezing.ToString());
                rpc.Perceive(EventHelper.PropertyChange("IsFreezing(" + rpc.CharacterName.ToString() + ")", IsFreezing.ToString(), rpc.CharacterName.ToString()));
            }

            bv = rpc.GetBeliefValue("IsOverheating(" + rpc.CharacterName.ToString() + ")");
            if (bv == null || !bv.Equals(IsOverheating.ToString()))
            {
                Debug.WriteLine("IsOverheating: " + bv + " -> " + IsOverheating.ToString());
                rpc.Perceive(EventHelper.PropertyChange("IsOverheating(" + rpc.CharacterName.ToString() + ")", IsOverheating.ToString(), rpc.CharacterName.ToString()));
            }

            bv = rpc.GetBeliefValue("Moisture(" + rpc.CharacterName.ToString() + ")");
            if (bv == null || !bv.Equals(Moisture.ToString()))
            {
                Debug.WriteLine("Moisture: " + bv + " -> " + Moisture.ToString());
                rpc.Perceive(EventHelper.PropertyChange("Moisture(" + rpc.CharacterName.ToString() + ")", Moisture.ToString(), rpc.CharacterName.ToString()));
            }

            bv = rpc.GetBeliefValue("Temperature(" + rpc.CharacterName.ToString() + ")");
            if (bv == null || !bv.Equals(Temperature.ToString()))
            {
                Debug.WriteLine("Temperature: " + bv + " -> " + Temperature.ToString());
                rpc.Perceive(EventHelper.PropertyChange("Temperature(" + rpc.CharacterName.ToString() + ")", Temperature.ToString(), rpc.CharacterName.ToString()));
            }

            bv = rpc.GetBeliefValue("IsBusy(" + rpc.CharacterName.ToString() + ")");
            if (bv == null || !bv.Equals(IsBusy.ToString()))
            {
                Debug.WriteLine("IsBusy: " + bv + " -> " + IsBusy.ToString());
                rpc.Perceive(EventHelper.PropertyChange("IsBusy(" + rpc.CharacterName.ToString() + ")", IsBusy.ToString(), rpc.CharacterName.ToString()));
            }

            bv = rpc.GetBeliefValue("PosX(" + rpc.CharacterName.ToString() + ")");
            if (bv == null || !bv.Equals(PosX.ToString()))
            {
                rpc.Perceive(EventHelper.PropertyChange("PosX(" + rpc.CharacterName.ToString() + ")", PosX.ToString(), rpc.CharacterName.ToString()));
            }

            /*
             * The Y-axis is always equal to zero, no need to save it in the knowledge base
             * */
            //bv = rpc.GetBeliefValue("PosY(" + rpc.CharacterName.ToString() + ")");
            //if (bv == null || !bv.Equals(PosY.ToString()))
            //    rpc.Perceive(EventHelper.PropertyChange("PosY(" + rpc.CharacterName.ToString() + ")", PosY.ToString(), rpc.CharacterName.ToString()));

            bv = rpc.GetBeliefValue("PosZ(" + rpc.CharacterName.ToString() + ")");
            if (bv == null || !bv.Equals(PosZ.ToString()))
            {
                rpc.Perceive(EventHelper.PropertyChange("PosZ(" + rpc.CharacterName.ToString() + ")", PosZ.ToString(), rpc.CharacterName.ToString()));
            }


            foreach (Item i in Vision)
            {
                if (i != null)
                {
                    bv = rpc.GetBeliefValue("InSight(" + i.GUID + ")");
                    if (bv == null || !bv.Equals("True"))
                    {
                        rpc.Perceive(EventHelper.PropertyChange("InSight(" + i.GUID + ")", "True", rpc.CharacterName.ToString()));
                    }
                    i.UpdatePerception(rpc);
                }
            }

            foreach (Item i in ItemSlots)
            {
                if (i != null)
                {
                    bv = rpc.GetBeliefValue("InInventory(" + i.GUID + ")");
                    if (bv == null || !bv.Equals("True"))
                    {
                        rpc.Perceive(EventHelper.PropertyChange("InInventory(" + i.GUID + ")", "TRUE", rpc.CharacterName.ToString()));
                    }
                    i.UpdatePerception(rpc);
                }
            }

            foreach (EquippedItems i in EquipSlots)
            {
                if (i != null)
                {
                    bv = rpc.GetBeliefValue("IsEquipped(" + i.GUID + "," + i.Slot + ")");
                    if (bv == null || !bv.Equals("True"))
                    {
                        rpc.Perceive(EventHelper.PropertyChange("IsEquipped(" + i.GUID + "," + i.Slot + ")", "TRUE", rpc.CharacterName.ToString()));
                    }
                    i.UpdatePerception(rpc);
                }
            }

            rpc.Update();
        }