当前位置: 首页>>代码示例>>C#>>正文


C# State.getPosition方法代码示例

本文整理汇总了C#中State.getPosition方法的典型用法代码示例。如果您正苦于以下问题:C# State.getPosition方法的具体用法?C# State.getPosition怎么用?C# State.getPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在State的用法示例。


在下文中一共展示了State.getPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeAgentBrain

    ////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////
    // Use this for initialization
    public void InitializeAgentBrain()
    {
        // NAV MESH AGENT TEST
        GetComponent<NavMeshAgent>().Stop ();
        GetComponent<NavMeshAgent>().updatePosition = false;
        GetComponent<NavMeshAgent>().updateRotation = false;

        locomotionSystem = GetComponent<SoldierLocomotion>();

        // initializing neighbor lists
        neighborObstacles =  GetComponent<NeighbourObstacles>();
        neighborObstacles.Init ();

        neighborAgents = GetComponent<NeighbourAgents>();
        neighborAgents.Init();

        currentState = new State(transform.position);

        if (GlobalNavigator.usingDynamicNavigationMesh)
        {
            currentPolygonIndex = GlobalNavigator.recastSteeringManager.GetClosestPolygon(currentState.getPosition());
        }

        if ( goal == null ) Debug.LogError("Goal has not been initialized for this agent");
        goalState = goal.goalState;

        passableMask = 1; // this could be part of the goal

        globalPath = new List<State> ();
        numGlobalPathWaypoints = 0;

        globalPathPolygonIndices = new List<uint> ();

        localPaths = new List<List<State>> ();
        spaceTimePaths = new List<List<State>> ();
        currentPlanExecutionIndex = 0;

        offMeshLinkWayPoint = new List<bool>();

        taskManager = new TaskManager ();

        // creating global navigation task
         globalNavigationTask = new GlobalNavigationtask(currentState,goalState,passableMask,
            TaskPriority.RealTime, taskManager);
        globalNavigationTask.taskName = "globalNavigationTask";

        // EVENT: AgentBrain is triggered by the globalNavigationTask when GLOBAL_PATH_CHANGED
        globalNavigationTask.registerObserver(Event.GLOBAL_PATH_CHANGED, this);

        gridNavigationTasks = new List<GridNavigationTask>();

        // creating grid navigation and grid time tasks for each statically allocated global waypoint
        // -- we can statically allocate how many ever we want
        for (int i=0; i < 1; i ++ )
        {
            _addNewEmptyGlobalPathWayPointAtIndex(i);
        }

        curves = new AnimationCurve[4];
        curves[0] = new AnimationCurve(); // x
        curves[1] = new AnimationCurve(); // y
        curves[2] = new AnimationCurve(); // z
        curves[3] = new AnimationCurve(); // speed
    }
开发者ID:SymphonyX,项目名称:VAST,代码行数:67,代码来源:AgentBrain.cs

示例2: ApproximatelyEquals

 public bool ApproximatelyEquals( State otherState, float distanceThreshold = 0.25F, float timeThreshold = 1.0F)
 {
     return (Vector3.Distance(otherState.getPosition(),this.getPosition()) < distanceThreshold);
         //&& Mathf.Abs(this._time - otherState._time) < timeThreshold);
 }
开发者ID:SymphonyX,项目名称:VAST,代码行数:5,代码来源:State.cs


注:本文中的State.getPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。