Esempio n. 1
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("Collectable(" + GUID + ")");
            if (b == null || !(b.Equals(Collectable.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("Collectable(" + GUID + ")", Collectable.ToString(), rpc.CharacterName.ToString()));
            }

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

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

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

            b = rpc.GetBeliefValue("Edible(" + GUID + ")");
            if (b == null || !(b.Equals(Edible.ToString())))
            {
                rpc.Perceive(EventHelper.PropertyChange("Edible(" + GUID + ")", Edible.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()));
            }
        }