Exemplo n.º 1
0
        private IEnumerator DelayedMove(agentsActionStatus status)
        {
            yield return(new WaitForSeconds(this.lingerForSeconds));

            currentActionStatus = agentsActionStatus.Wandering;             // continue to wander...
            Debug.Log("continue to wander...");
            MoveNext(false);
        }
Exemplo n.º 2
0
        private IEnumerator gettingInfo()
        {
            yield return(new WaitForSeconds(this.aquireInfoDuration));

            currentActionStatus = agentsActionStatus.Wandering;             // continue to wander...
            Debug.Log("got info, continue to wander...");
            MoveNext(false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Called on Start and OnEnable, but only one of the two, i.e. at startup it is only called once.
        /// </summary>
        protected override void OnStartAndEnable()
        {
            GameServices.messageBus.Subscribe(this);
            //_startPos = _unit.position;

            MoveNext(false);
            if (this.lingerForSeconds == 0.0f)
            {
                MoveNext(true);
            }

            currentActionStatus = agentsActionStatus.Wandering;             //Inital state is wander
        }
Exemplo n.º 4
0
        public string communicationRequest(GameObject requestingAgent)         //communication request received, decide and do response (mood/social energy level)

        {
            if (infopointsVisited.Count == 0)
            {
                Debug.LogFormat("<color=red>{0} refused because it has not visited any infopoints</color>", gameObject.name);

                return("refuse");
            }


            AgentBehaviourScriptCommunicating = requestingAgent.GetComponent <AgentBehaviour>();

            Debug.LogFormat("{0} sent a request to {1}", requestingAgent.name, gameObject.name);

            if (agentEncapsulatorScript.socialEnergy > agentEncapsulatorScript.socialEnergyTreshold)
            {
                List <GameObject> possibleInfopoints = infopointsVisited.Except(AgentBehaviourScriptCommunicating.infopointsVisited).ToList();

                if (possibleInfopoints.Count != 0)
                {
                    GameObject closestInfopoint = FindClosestItem(possibleInfopoints);

                    Debug.LogFormat("<color=green>{0} had visited infopoints that {1} havent visited and its sending the information about {2}</color>", gameObject.name, requestingAgent.name, closestInfopoint.name);

                    AgentBehaviourScriptCommunicating.infopointRequest(closestInfopoint);

                    currentActionStatus = agentsActionStatus.Communicating;

                    updateSocial();

                    return("accept");
                }
                else
                {
                    Debug.LogFormat("<color=yellow>{0} had visited infopoints but {1} has already visited them</color>", gameObject.name, requestingAgent.name);

                    return("refuse");
                }
            }
            else
            {
                Debug.LogFormat("<color=red>{0} refused because of low social energy</color>", gameObject.name);

                return("refuse");
            }
        }
Exemplo n.º 5
0
        private string communicateWithAgent(GameObject targetAgent)

        {
            string responseMessage = "";

            AgentBehaviourScript = targetAgent.GetComponent <AgentBehaviour>();

            currentActionStatus = agentsActionStatus.Communicating;

            responseMessage = AgentBehaviourScript.communicationRequest(gameObject);

            //targetAgent.transform.localScale = new Vector3 (5,5,5);

            //_unit.transform.localScale = new Vector3 (5,5,5);

            return(responseMessage);
        }