예제 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="group">The navigation mesh group the agent
 /// belongs to.</param>
 /// <param name="transform">The agent's transform.</param>
 public NavAgent(Transform transform, NavGroup navGroup, NavAgentGroup agentGroup)
 {
     this.agentGroup  = agentGroup;
     this.navGroup    = new NavGroup(navGroup, false);
     this.transform   = transform;
     this.wideExtents = navGroup.extents * 10;
     RevertToAgentGroup();
 }
예제 #2
0
파일: NavAgent.cs 프로젝트: oathx/Six
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="group">The navigation mesh group the agent
 /// belongs to.</param>
 /// <param name="transform">The agent's transform.</param>
 public NavAgent(Transform transform, NavGroup navGroup, NavAgentGroup agentGroup)
 {
     this.agentGroup = agentGroup;
     this.navGroup = new NavGroup(navGroup, false);
     this.transform = transform;
     this.wideExtents = navGroup.extents * 10;
     RevertToAgentGroup();
 }
예제 #3
0
    public NavAgentGroup CreateAgentGroup(int index, int maxPath, int maxStraightPath
        , out byte group)
    {
        group = mGroups[index * 2 + 0];

        CrowdAgentParams cap = new CrowdAgentParams();

        cap.avoidanceType = mGroups[index * 2 + 1];
        cap.collisionQueryRange = mGroupData[index * GroupStide + QueryOffset];
        cap.height = mGroupData[index * GroupStide + HeightOffset];
        cap.maxAcceleration = mGroupData[index * GroupStide + AccelOffset];
        cap.maxSpeed = mGroupData[index * GroupStide + JogOffset];
        cap.pathOptimizationRange = mGroupData[index * GroupStide + OptiOffset];
        cap.radius = mGroupData[index * GroupStide + RadiusOffset];
        cap.separationWeight = mGroupData[index * GroupStide + SepOffset];
        cap.updateFlags = mUpdateFlags[index];

        NavAgentGroup result = new NavAgentGroup(
            cap, maxPath, maxStraightPath, mPoolData[index * 2 + 0], mPoolData[index * 2 + 1]);

        result.jogSpeed = mGroupData[index * GroupStide + JogOffset];
        result.maxTurnSpeed = mGroupData[index * GroupStide + TurnOffset];
        result.runSpeed = mGroupData[index * GroupStide + RunOffset];
        result.walkSpeed = mGroupData[index * GroupStide + WalkOffset];

        return result;
    }