Exemple #1
0
        private void Update()
        {
            if (!Controller.CrowdController.TryGetAgent(CrowdIndex, out NavAgentDebug))
            {
                return;
            }

            NavAgent      agent    = NavAgentDebug.NavAgent;
            AgentPathData pathData = NavAgentDebug.PathData;

            //transform.position = Vector3.MoveTowards(transform.position, readOnlyAgent.DtCrowdAgent.Position, Time.deltaTime * 10f);
            transform.position = agent.DtCrowdAgent.Position;
        }
Exemple #2
0
        public bool TryAddAgent(float3 position, DtAgentParams agentParams, out NavAgent agent)
        {
            agent = new NavAgent
            {
                Active        = true,
                DtAgentParams = agentParams,
                Destination   = position
            };

            if (AiCrowd.TryAddAgent(position, agentParams, out int crowdIndex))
            {
                agent.CrowdIndex = crowdIndex;
                return(true);
            }
            else
            {
                return(false);
            }
        }