public void RemoveFact(string factName, WorkingMemoryValue factValue) //Removes a fact from the workingmemory { //tempList is needed for 'collection has changed' error if we change directly in list List <WorkingMemoryValue> tempList = GetFact(factName); foreach (WorkingMemoryValue wm in GetFact(factName)) { if (wm.GetFactValue().Equals(factValue.GetFactValue())) { tempList.Remove(wm); break; } else { //Do nothing } } if (tempList.Count == 0) { knownFacts.Remove(factName); } else { knownFacts[factName] = tempList; } blackBoard.RemoveFact(clan, factName, factValue); //also remove the fact from the blackboard }
public void RemoveFact(string factName, WorkingMemoryValue factValue) { //tempList is needed for 'collection has changed' if we change directly in list List<WorkingMemoryValue> tempList = GetFact(factName); foreach(WorkingMemoryValue wm in GetFact(factName)) { if(wm.GetFactValue().Equals(factValue.GetFactValue())) { tempList.Remove(wm); break; } else { //Do nothing } } if(tempList.Count == 0) { knownFacts.Remove(factName); } else { knownFacts[factName] = tempList; } blackBoard.RemoveFact(clan, factName, factValue); }
public void RemoveFact(string factName, WorkingMemoryValue factValue) { //tempList is needed for 'collection has changed' if we change directly in list List <WorkingMemoryValue> tempList = GetFact(factName); foreach (WorkingMemoryValue wm in GetFact(factName)) { if (wm.GetFactValue() == factValue.GetFactValue()) { tempList.Remove(wm); break; } else { //Do nothing } } if (tempList.Count == 0) { knownFacts.Remove(factName); } else { knownFacts[factName] = tempList; } }
public void SetFact(string clan, string name, WorkingMemoryValue factValue) { bool alreadyKnown = false; foreach (WorkingMemoryValue vm in tribeFacts[clan].GetFact(name)) { if (vm.GetFactValue().Equals(factValue.GetFactValue())) { //Already knows about it Debug.Log("Klanen vet redan det här!"); alreadyKnown = true; break; } } if (!alreadyKnown) { tribeFacts[clan].SetFact(name, factValue); } if (name == "Agents") { tribeFacts[clan].ChangeNumberAgentsInClan(1); } }
public void SetFact(string name, WorkingMemoryValue factValue) { if (!knownFacts.ContainsKey(name)) { List <WorkingMemoryValue> tempList = new List <WorkingMemoryValue>(); tempList.Add(factValue); knownFacts.Add(name, tempList); } else { knownFacts[name].Add(factValue); } }
public void SetFact(string name, WorkingMemoryValue factValue) //add a fact to the clan facts { if (!knownFacts.ContainsKey(name)) //If this type of fact dont exist in the facts then need to add a new list with the fact of the new fact type, ex. knownFacts["Buildings"] { List <WorkingMemoryValue> tempList = new List <WorkingMemoryValue>(); tempList.Add(factValue); knownFacts.Add(name, tempList); } else //The fact type already excist so att a new value for it { knownFacts[name].Add(factValue); } }
public void SetFact(string name, WorkingMemoryValue factValue) //Adds a new fact to the workingmemory of the agent { if (!knownFacts.ContainsKey(name)) //If this type of fact dont exist in workingmemory then need to add a new list with the fact of the new fact type, ex. knownFacts["Buildings"] { List <WorkingMemoryValue> tempList = new List <WorkingMemoryValue>(); tempList.Add(factValue); knownFacts.Add(name, tempList); } else //The fact type already excist //Check if we already have the same value in the memory { bool alreadyKnown = false; foreach (WorkingMemoryValue vm in knownFacts[name]) { if (vm.GetFactValue().Equals(factValue.GetFactValue())) { //Already knows about it alreadyKnown = true; break; } } if (!alreadyKnown) //If we dont have it then add it { knownFacts[name].Add(factValue); } } //Check if it is a globaly important fact that everyone needs to know about, then send it to the blackboard //if(name == "Red" || name == "Blue" || name == "Yellow" || name == "Buildings" || name == "Orange" || name == "Green" || name == "Magenta") //{ //Also add the fact to the global blackboard for the clan so everyone knows about it blackBoard.SetFact(clan, name, factValue); //} }
public void SetFact(string name, WorkingMemoryValue factValue) { if (!knownFacts.ContainsKey(name)) { List <WorkingMemoryValue> tempList = new List <WorkingMemoryValue>(); tempList.Add(factValue); knownFacts.Add(name, tempList); } else { //Check if already exist bool alreadyKnown = false; foreach (WorkingMemoryValue vm in knownFacts[name]) { if (vm.GetFactValue().Equals(factValue.GetFactValue())) { //Already knows about it alreadyKnown = true; Debug.Log("!!!!!!!!!!!!! already know this!"); break; } } if (!alreadyKnown) { Debug.Log("Adding information to workingMemory!"); knownFacts[name].Add(factValue); } } //Check if it is a globaly important fact that everyone needs to know about, then send it to the blackboard //if(name == "Red" || name == "Blue" || name == "Yellow" || name == "Buildings" || name == "Orange" || name == "Green" || name == "Magenta") //{ blackBoard.SetFact(clan, name, factValue); //} }
public void SetFact(string clan, string name, WorkingMemoryValue factValue) //set a new fact for a clan { bool alreadyKnown = false; foreach (WorkingMemoryValue vm in tribeFacts[clan].GetFact(name)) { if (vm.GetFactValue().Equals(factValue.GetFactValue())) { //Already knows about it alreadyKnown = true; break; } } if (!alreadyKnown) //if we dont know the fact then add it { tribeFacts[clan].SetFact(name, factValue); } if (name == "Agents") //if the fact is about a new agent increase the fact about number of agents { tribeFacts[clan].ChangeNumberAgentsInClan(1); } }
public void SetFact(string name, WorkingMemoryValue factValue) { if(!knownFacts.ContainsKey(name)){ List<WorkingMemoryValue> tempList = new List<WorkingMemoryValue>(); tempList.Add(factValue); knownFacts.Add(name, tempList); } else { knownFacts[name].Add(factValue); } }
public void RemoveFact(string clan, string factName, WorkingMemoryValue factValue) //remove a fact for a clan { tribeFacts[clan].RemoveFact(factName, factValue); }
//add a fact to the clan facts public void SetFact(string name, WorkingMemoryValue factValue) { if(!knownFacts.ContainsKey(name)){ //If this type of fact dont exist in the facts then need to add a new list with the fact of the new fact type, ex. knownFacts["Buildings"] List<WorkingMemoryValue> tempList = new List<WorkingMemoryValue>(); tempList.Add(factValue); knownFacts.Add(name, tempList); } else { //The fact type already excist so att a new value for it knownFacts[name].Add(factValue); } }
public void SetFact(string name, WorkingMemoryValue factValue) { if(!knownFacts.ContainsKey(name)){ List<WorkingMemoryValue> tempList = new List<WorkingMemoryValue>(); tempList.Add(factValue); knownFacts.Add(name, tempList); } else { //Check if already exist bool alreadyKnown = false; foreach(WorkingMemoryValue vm in knownFacts[name]) { if(vm.GetFactValue().Equals(factValue.GetFactValue())) { //Already knows about it alreadyKnown = true; Debug.Log ("!!!!!!!!!!!!! already know this!"); break; } } if(!alreadyKnown) { Debug.Log("Adding information to workingMemory!"); knownFacts[name].Add(factValue); } } //Check if it is a globaly important fact that everyone needs to know about, then send it to the blackboard //if(name == "Red" || name == "Blue" || name == "Yellow" || name == "Buildings" || name == "Orange" || name == "Green" || name == "Magenta") //{ blackBoard.SetFact(clan, name, factValue); //} }
//Adds a new fact to the workingmemory of the agent public void SetFact(string name, WorkingMemoryValue factValue) { if(!knownFacts.ContainsKey(name)){ //If this type of fact dont exist in workingmemory then need to add a new list with the fact of the new fact type, ex. knownFacts["Buildings"] List<WorkingMemoryValue> tempList = new List<WorkingMemoryValue>(); tempList.Add(factValue); knownFacts.Add(name, tempList); } else { //The fact type already excist //Check if we already have the same value in the memory bool alreadyKnown = false; foreach(WorkingMemoryValue vm in knownFacts[name]) { if(vm.GetFactValue().Equals(factValue.GetFactValue())) { //Already knows about it alreadyKnown = true; break; } } if(!alreadyKnown) //If we dont have it then add it { knownFacts[name].Add(factValue); } } //Check if it is a globaly important fact that everyone needs to know about, then send it to the blackboard //if(name == "Red" || name == "Blue" || name == "Yellow" || name == "Buildings" || name == "Orange" || name == "Green" || name == "Magenta") //{ //Also add the fact to the global blackboard for the clan so everyone knows about it blackBoard.SetFact(clan, name, factValue); //} }
//set a new fact for a clan public void SetFact(string clan, string name, WorkingMemoryValue factValue) { bool alreadyKnown = false; foreach(WorkingMemoryValue vm in tribeFacts[clan].GetFact(name)) { if(vm.GetFactValue().Equals( factValue.GetFactValue())) { //Already knows about it alreadyKnown = true; break; } } if(!alreadyKnown) //if we dont know the fact then add it { tribeFacts[clan].SetFact(name, factValue); } if(name == "Agents") //if the fact is about a new agent increase the fact about number of agents { tribeFacts[clan].ChangeNumberAgentsInClan(1); } }
public void RemoveFact(string clan, string factName, WorkingMemoryValue factValue) { tribeFacts[clan].RemoveFact(factName, factValue); }
public void SetFact(string clan, string name, WorkingMemoryValue factValue) { bool alreadyKnown = false; foreach(WorkingMemoryValue vm in tribeFacts[clan].GetFact(name)) { if(vm.GetFactValue().Equals( factValue.GetFactValue())) { //Already knows about it Debug.Log("Klanen vet redan det här!"); alreadyKnown = true; break; } } if(!alreadyKnown) { tribeFacts[clan].SetFact(name, factValue); } if(name == "Agents") { tribeFacts[clan].ChangeNumberAgentsInClan(1); } }