コード例 #1
0
ファイル: Goal_Movement.cs プロジェクト: pandaboy/Village
 public Goal_MoveToPosition(CognitiveAgent owner, Vector3 destination)
     : base(owner)
 {
     NavMeshHit hit;
     NavMesh.SamplePosition(destination, out hit, 20.0f, 1);
     this.destination = hit.position;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: AgentInventory.cs プロジェクト: pandaboy/Village
    public AgentInventory(CognitiveAgent Owner)
    {
        OwnerDetails = Owner.CharDetails;
        OwnerCue = Owner.CharacterCue;
        OwnerMind = Owner.MindsEye;

        EquippedUID = string.Empty;
    }
コード例 #4
0
ファイル: Message.cs プロジェクト: pandaboy/Village
	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);
	}
コード例 #5
0
ファイル: Goal_Conversation.cs プロジェクト: pandaboy/Village
    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);
    }
コード例 #6
0
ファイル: ShopManager.cs プロジェクト: pandaboy/Village
    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;
    }
コード例 #7
0
ファイル: Goal_Conversation.cs プロジェクト: pandaboy/Village
    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);
    }
コード例 #8
0
        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]);
        }
コード例 #9
0
ファイル: Goal_Idle.cs プロジェクト: pandaboy/Village
 public Goal_Idle_StableWork(CognitiveAgent owner)
     : base(owner) { }
コード例 #10
0
ファイル: Goal.cs プロジェクト: pandaboy/Village
 public Goal_Atomic(CognitiveAgent owner)
     : base(owner) { }
コード例 #11
0
ファイル: Goal_Movement.cs プロジェクト: pandaboy/Village
    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;
    }
コード例 #12
0
ファイル: Goal_Movement.cs プロジェクト: pandaboy/Village
    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;
    }
コード例 #13
0
ファイル: Goal_Quest.cs プロジェクト: pandaboy/Village
 public Goal_Quest(CognitiveAgent owner, string cueUID)
     : base(owner)
 {
     this.cueUID = cueUID;
 }
コード例 #14
0
ファイル: Goal_Shop.cs プロジェクト: pandaboy/Village
 public Goal_ShopKeeping(CognitiveAgent owner)
     : base(owner) { }
コード例 #15
0
ファイル: Goal_Shop.cs プロジェクト: pandaboy/Village
 public Goal_BuyItem(CognitiveAgent owner, ShopManager shopManager, string itemUID)
     : base(owner)
 {
     this.shopManager = shopManager;
     this.itemUID = itemUID;
 }
コード例 #16
0
ファイル: Goal_Idle.cs プロジェクト: pandaboy/Village
 public Goal_Idle_Fish(CognitiveAgent owner)
     : base(owner) { }
コード例 #17
0
ファイル: Goal_StableGroom.cs プロジェクト: pandaboy/Village
 public Goal_GatherHay(CognitiveAgent owner)
     : base(owner) { }
コード例 #18
0
ファイル: Goal_Lumberjack.cs プロジェクト: pandaboy/Village
 public Goal_DropWoodOff(CognitiveAgent owner)
     : base(owner) { }
コード例 #19
0
ファイル: Goal_Idle.cs プロジェクト: pandaboy/Village
 public Goal_Idle_Shopkeep(CognitiveAgent owner)
     : base(owner) { }
コード例 #20
0
ファイル: Goal_Food.cs プロジェクト: pandaboy/Village
 public Goal_ConsumeFood(CognitiveAgent owner)
     : base(owner) { }
コード例 #21
0
ファイル: Goal_Shop.cs プロジェクト: pandaboy/Village
 public Goal_ManageShop(CognitiveAgent owner, ShopManager shopManager)
     : base(owner)
 {
     this.shopManager = shopManager;
 }
コード例 #22
0
ファイル: Goal_Food.cs プロジェクト: pandaboy/Village
 public Goal_Eat(CognitiveAgent owner)
     : base(owner) { }
コード例 #23
0
ファイル: Goal_Shop.cs プロジェクト: pandaboy/Village
 public Goal_PurchaseItem(CognitiveAgent owner, string itemUID)
     : base(owner)
 {
     this.itemUID = itemUID;
 }
コード例 #24
0
ファイル: Goal_Fisher.cs プロジェクト: pandaboy/Village
 public Goal_Fishing(CognitiveAgent owner)
     : base(owner) { }
コード例 #25
0
ファイル: Goal_Scheduler.cs プロジェクト: pandaboy/Village
 public Goal_Scheduler(CognitiveAgent owner, Task initTask)
     : base(owner)
 {
     UpdateTask(initTask);
 }
コード例 #26
0
ファイル: Goal_Idle.cs プロジェクト: pandaboy/Village
 public Goal_Idle_WoodCut(CognitiveAgent owner)
     : base(owner) { }
コード例 #27
0
ファイル: Goal_Movement.cs プロジェクト: pandaboy/Village
 public Goal_FollowPath(CognitiveAgent owner, NavMeshPath navPath)
     : base(owner)
 {
     this.navPath = navPath;
 }
コード例 #28
0
ファイル: Goal_Idle.cs プロジェクト: pandaboy/Village
 public Goal_Idle_LumberJack(CognitiveAgent owner)
     : base(owner) { }
コード例 #29
0
ファイル: Goal_Movement.cs プロジェクト: pandaboy/Village
 public Goal_HeadToAreaAndPatrol(CognitiveAgent owner, string targetUID)
     : base(owner)
 {
     this.targetUID = targetUID;
 }
コード例 #30
0
ファイル: Goal_Idle.cs プロジェクト: pandaboy/Village
 public Goal_Idle_Quest(CognitiveAgent owner)
     : base(owner) { }
コード例 #31
0
ファイル: MemoryGraph.cs プロジェクト: pandaboy/Village
    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;
    }
コード例 #32
0
ファイル: Goal_Idle.cs プロジェクト: pandaboy/Village
 public Goal_Idle_Blacksmith(CognitiveAgent owner)
     : base(owner) { }