本文整理汇总了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
}
示例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);
}