예제 #1
0
        public int CrowdAddAgent(T crowdId, Vector3 pos, ref SCrowdAgentParams param)
        {
            NavCrowdEntry entry = GetCrowdEntry(crowdId);

            if (entry == null)
            {
                logOne("3GetCrowdEntry is null, CrowdId = {0}", crowdId);
                return(-1);
            }

            //float[] fpos = new float[3];
            _Float3_Pos200[0] = pos.x;
            _Float3_Pos200[1] = pos.y;
            _Float3_Pos200[2] = pos.z;
            Common.SCounters.Instance.Increase(EnumCountType.crowdAddAgent);
            return(LuaDLL.NM_crowdAddAgent(entry.navCrowd, _Float3_Pos200, ref param));
        }
예제 #2
0
        public bool CrowdSetAgentSpeed(T crowdId, int idx, float speed)
        {
            NavCrowdEntry entry = GetCrowdEntry(crowdId);

            if (entry == null)
            {
                logOne("41GetCrowdEntry is null, CrowdId = {0}", crowdId);
                return(false);
            }

            // 如果调用频繁,考虑将new放在外面
            SCrowdAgentParams param = new SCrowdAgentParams();

            if (!LuaDLL.NM_crowdGetAgentParam(entry.navCrowd, idx, out param))
            {
                return(false);
            }
            param.maxSpeed = speed;
            return(LuaDLL.NM_crowdUpdateAgentParam(entry.navCrowd, idx, ref param));
        }
예제 #3
0
        public bool CrowdGetAgentSpeed(T crowdId, int idx, out float speed)
        {
            NavCrowdEntry entry = GetCrowdEntry(crowdId);

            if (entry == null)
            {
                logOne("15GetCrowdEntry is null, CrowdId = {0}", crowdId);
                speed = 0.0f;
                return(false);
            }

            // 如果调用频繁,考虑将new放在外面
            SCrowdAgentParams param = new SCrowdAgentParams();

            if (!LuaDLL.NM_crowdGetAgentParam(entry.navCrowd, idx, out param))
            {
                speed = 0.0f;
                return(false);
            }
            speed = param.maxSpeed;
            return(true);
        }