public Goal_MoveToPosition(CognitiveAgent owner, Vector3 destination) : base(owner) { NavMeshHit hit; NavMesh.SamplePosition(destination, out hit, 20.0f, 1); this.destination = hit.position; }
private void SetAgentKnowledge(CognitiveAgent actor, IReadOnlyList <IAgentId> knowledgeIds, int i) { var index = 0; switch (ExampleMainOrganization.Knowledge) { case 0: // same Knowledge for all index = 0; break; case 1: // Knowledge is by group index = i; break; case 2: // Knowledge is randomly defined for agentId index = DiscreteUniform.Sample(0, ExampleMainOrganization.GroupsCount - 1); break; } actor.KnowledgeModel.AddKnowledge(knowledgeIds[index], ExampleMainOrganization.KnowledgeLevel, actor.Cognitive.InternalCharacteristics.MinimumRemainingKnowledge, actor.Cognitive.InternalCharacteristics.TimeToLive); }
public AgentInventory(CognitiveAgent Owner) { OwnerDetails = Owner.CharDetails; OwnerCue = Owner.CharacterCue; OwnerMind = Owner.MindsEye; EquippedUID = string.Empty; }
public static void SendMessage(CognitiveAgent agent, Telegram telegram) { agent.HandleMessage(telegram); //if(agent.HandleMessage(telegram)) // Debug.Log("A message " + (telegram.IsResponse ? "response" : "") + " ( " + telegram.TelegramType + " ) was handled by " + agent.name); //else // Debug.Log("A message " + (telegram.IsResponse ? "response" : "") + " ( " + telegram.TelegramType + " ) was left unhandled by " + agent.name); }
public Goal_LookForPerson(CognitiveAgent owner, string targetUID) : base(owner) { this.targetUID = targetUID; locationUIDs = new List<string>(); if (!Owner.MindsEye.GetConceptNeighbours(targetUID, MemoryType.Location, ref locationUIDs)) CurrentStatus = GoalStatus.Failed; //throw new UnityException("I can't remember anything! I've no idea what to doooooooooooooooo! - " + Owner.name); }
internal bool AttemptPurchase(CognitiveAgent Owner, string itemUID) { for(int i = 0; i < ShopItems.Length; i++) { if(ShopItems[i] != null && ShopItems[i].UniqueNodeID == itemUID) { Owner.Inventory.PickupItem(ShopItems[i], false); return true; } } return false; }
public Goal_MeetAndRequestInfo(CognitiveAgent owner, string cueUID) : base(owner) { //Debug.Log(cueUID); this.cueUID = cueUID; Owner.DesiredTopic = cueUID; targetUIDs = new List<string>(); if (!Owner.MindsEye.GetConceptNeighbours("Villagers", ref targetUIDs)) CurrentStatus = GoalStatus.Failed; //throw new UnityException("I can't remember anything! I've no idea what to doooooooooooooooo! - " + Owner.name); //Debug.Log("Activating the Goal_MeetAndRequestInfo - " + targetUIDs.Count); }
private void SetAgentTasks(CognitiveAgent actor, IReadOnlyList <IAgentId> taskIds, int i) { var index = 0; switch (ExampleMainOrganization.Activities) { case 0: // same activity for all index = 0; break; case 1: // Activity is by group index = i; break; case 2: // Activity is randomly defined for agentId index = DiscreteUniform.Sample(0, ExampleMainOrganization.GroupsCount - 1); break; } actor.TaskModel.AddActorTask(taskIds[index]); }
public Goal_Idle_StableWork(CognitiveAgent owner) : base(owner) { }
public Goal_Atomic(CognitiveAgent owner) : base(owner) { }
double startTime; //This records the time this goal was activated. public Goal_TraverseNode(CognitiveAgent owner, Vector3 target, bool last) : base(owner) { this.targetLocation = target; this.lastEdgeInPath = last; prevPosition = owner.Transform.position; }
public Goal_PatrolArea(CognitiveAgent owner, string targetUID, bool loopPatrol = false) : base(owner) { this.targetUID = targetUID; this.loopPatrol = loopPatrol; patrolTransforms = LocationManager.Instance.GetLocation(targetUID); currentPatrolPoint = 0; }
public Goal_Quest(CognitiveAgent owner, string cueUID) : base(owner) { this.cueUID = cueUID; }
public Goal_ShopKeeping(CognitiveAgent owner) : base(owner) { }
public Goal_BuyItem(CognitiveAgent owner, ShopManager shopManager, string itemUID) : base(owner) { this.shopManager = shopManager; this.itemUID = itemUID; }
public Goal_Idle_Fish(CognitiveAgent owner) : base(owner) { }
public Goal_GatherHay(CognitiveAgent owner) : base(owner) { }
public Goal_DropWoodOff(CognitiveAgent owner) : base(owner) { }
public Goal_Idle_Shopkeep(CognitiveAgent owner) : base(owner) { }
public Goal_ConsumeFood(CognitiveAgent owner) : base(owner) { }
public Goal_ManageShop(CognitiveAgent owner, ShopManager shopManager) : base(owner) { this.shopManager = shopManager; }
public Goal_Eat(CognitiveAgent owner) : base(owner) { }
public Goal_PurchaseItem(CognitiveAgent owner, string itemUID) : base(owner) { this.itemUID = itemUID; }
public Goal_Fishing(CognitiveAgent owner) : base(owner) { }
public Goal_Scheduler(CognitiveAgent owner, Task initTask) : base(owner) { UpdateTask(initTask); }
public Goal_Idle_WoodCut(CognitiveAgent owner) : base(owner) { }
public Goal_FollowPath(CognitiveAgent owner, NavMeshPath navPath) : base(owner) { this.navPath = navPath; }
public Goal_Idle_LumberJack(CognitiveAgent owner) : base(owner) { }
public Goal_HeadToAreaAndPatrol(CognitiveAgent owner, string targetUID) : base(owner) { this.targetUID = targetUID; }
public Goal_Idle_Quest(CognitiveAgent owner) : base(owner) { }
internal bool CopyFromOtherGraph(CognitiveAgent otherAgent, string cueID) { MemoryGraphNode otherMGN = otherAgent.MindsEye.GetConceptNode(cueID); if (otherMGN == null || otherMGN.Neighbours.Count == 0) return false; //Other agent has no idea about the cue, so has nothing to share. MemoryGraphNode ourMGN = GetNamedNodeFromGraph(cueID); if (ourMGN == null) ourMGN = AddNamedNodeToGraph(new MemoryNode(cueID, MemoryType.Cue)); RecursiveHash.Clear(); CopyFromOtherGraph(ourMGN, otherMGN, 0); return true; }
public Goal_Idle_Blacksmith(CognitiveAgent owner) : base(owner) { }