void FixedUpdate() { if (mStop) { return; } mNavMeshAgent.speed = mSpeed; mNavMeshAgent.destination = GetTargetPos(); var catchTarget = TfTraceTarget.IsCatchTargetWithPos(GetTargetPos(), CacheTransform.position, mStopDistance); mDistance = catchTarget.Item2; if (catchTarget.Item1) { if (StopAfterCatchTarget) { SetStop(true); } if (null != mOnCatchTarget) { mOnCatchTarget(this, catchTarget.Item2); } } }
void Update() { if (mStop) { return; } var catchTarget = TfTraceTarget.IsCatchTargetWithPos(mTargetPos, CacheTransform.position, mStopDistance); if (catchTarget.Item1) { if (StopAfterCatchTarget) { SetStop(true); } if (null != mOnCatchTarget) { mOnCatchTarget(this, catchTarget.Item2); } return; } CacheTransform.position = TfTraceTarget.ComputeNextPositionWithPos(CacheTransform.position, mTargetPos, mSpeed); }
public bool IsComplete() { var catchTarget = TfTraceTarget.IsCatchTargetWithPos(GetTargetPos(), CacheTransform.position, mStopDistance); return(catchTarget.Item1); }