public override void UpdateMemory(MemoryGraph memoryGraph, MemoryGraphNode retainedMemory, MemoryCue memCue, float UpdateFrequency) { ItemCue itemInfo = (ItemCue)memCue; status = itemInfo.Status; owner = itemInfo.Owner; durability = itemInfo.Durability; if (durability < 0.0f) { //Once durability starts to fall, a agent's affinity with an item will also drop. memoryGraph.UpdateCueOpinion(retainedMemory.MemoryNode, -UpdateFrequency); } base.UpdateMemory(memoryGraph, retainedMemory, memCue, UpdateFrequency); if (UpdateFrequency <= 0.0f || itemInfo.Owner == null) //We want to strengthen the memory between the specific item and the place it has been observed. return; MemoryGraphNode charNode; if (memoryGraph.Contains(itemInfo.Owner.UniqueNodeID)) charNode = memoryGraph.GetNamedNodeFromGraph(itemInfo.Owner.UniqueNodeID); else charNode = memoryGraph.AddNamedNodeToGraph(new CharacterNode(itemInfo.Owner)); //First make a connection between the character and the item. int index = charNode.Neighbours.IndexOf(retainedMemory); if (index == -1) memoryGraph.AddDirectedEdge(charNode, retainedMemory, UpdateFrequency, UpdateFrequency); else { //Strengthing the memory based on the length of time it was active in the working set. charNode.StrengthenMemory(index, UpdateFrequency); //charNode.OpinionStrengths[index] += UpdateFrequency; } //Then between the item and the character. index = retainedMemory.Neighbours.IndexOf(charNode); if (index == -1) memoryGraph.AddDirectedEdge(retainedMemory, charNode, UpdateFrequency, UpdateFrequency); else { //Strengthing the memory based on the length of time it was active in the working set. retainedMemory.StrengthenMemory(index, UpdateFrequency); //retainedMemory.OpinionStrengths[index] += UpdateFrequency; } }