Beispiel #1
0
    public BEHAVIOR_STATUS ExchangeInfo()
    {
        GameObject otherAgent = knowledgeBase.agentToTalkTo;

        if (Vector3.Distance(otherAgent.transform.position, transform.position) < 2.5)
        {
            // Debug.Log("Caught up to Agent " + otherAgent.GetComponent<Agent>().agentId);
            // once the agents are close enough, both of them stop moving
            if (isActiveAndEnabled)
            {
                agent.isStopped = true;
            }
            if (otherAgent.activeSelf)
            {
                otherAgent.GetComponent <NavMeshAgent>().isStopped = true;
            }

            knowledgeBase.ExchangeClues();

            numOfExchanges++;
            talkingCooldown = numOfExchanges;
            return(BEHAVIOR_STATUS.FAILURE);
        }
        return(BEHAVIOR_STATUS.SUCCESS);
    }