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


C++ FTimespan::GetTotalMilliseconds方法代码示例

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


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

示例1: ProcessExecutionRequest

void UHTNPlannerComponent::ProcessExecutionRequest()
{
	bRequestedExecutionUpdate = false;
	if(!IsRegistered())
	{
		// it shouldn't be called, component is no longer valid
		return;
	}

	if(bIsPaused)
	{
		UE_VLOG(GetOwner(), LogHTNPlanner, Verbose, TEXT("Ignoring ProcessExecutionRequest call due to HTNPlannerComponent still being paused"));
		return;
	}

	//GEngine->AddOnScreenDebugMessage(-1, 1.5f, FColor::Yellow, TEXT("UHTNPlannerComponent::ProcessExecutionRequest()"));

	if(PendingExecution.IsValid())
	{
		ProcessPendingExecution();
		return;
	}

	if(NumStackElements == 0)
	{
		//BestPlan = nullptr;

		if(CurrentPlannerAsset->bLoop)
		{
			// finished execution of plan and we want to loop, so re-start
			RestartPlanner();
		}
		else
		{
			bIsRunning = false;
		}

		return;
	}

#if HTN_LOG_RUNTIME_STATS
	if(StartPlanningTime == FDateTime::MinValue())
	{
		StartPlanningTime = FDateTime::UtcNow();
	}
#endif // HTN_LOG_RUNTIME_STATS

	FDateTime PlanningStart = FDateTime::UtcNow();
	while(NumStackElements > 0)
	{
		// our stack is not empty
		FTimespan TimePlanned = FDateTime::UtcNow() - PlanningStart;
		if(TimePlanned.GetTotalSeconds() >= CurrentPlannerAsset->MaxSearchTime)
		{
			// we've spent our maximum allowed search time for this tick on planning, so need to continue some other time
			ScheduleExecutionUpdate();

#if HTN_LOG_RUNTIME_STATS
			CumulativeSearchTimeMs += TimePlanned.GetTotalMilliseconds();
			++CumulativeFrameCount;
#endif
			return;
		}

#if HTN_LOG_RUNTIME_STATS
		++NumNodesExpanded;
#endif

		if(PreviousPlan.IsValid())
		{
			UE_LOG(LogHTNPlanner, Warning, TEXT("%d nodes in data structure(s)"), NumStackElements);
		}

		if(bProbabilisticPlanReuse && bHitLeaf)
		{
			// we've hit a leaf node, so it's time to re-evaluate whether we're ignoring plan reuse probabilistically
			bHitLeaf = false;

			if(NumStackElements == PlanningStack.Num())
			{
				bIgnoringPlanReuse = false;		// not ignoring plan reuse if everything's still in the non-prioritized stack
			}
			else
			{
				bIgnoringPlanReuse = (FMath::FRand() <= ProbabilityIgnorePlanReuse);
			}
		}

		const FHTNStackElement StackTop = PopStackElement();
		
		if(StackTop.Cost + Cast<UTaskNetwork>(StackTop.TaskNetwork->Task)->
		   GetHeuristicCost(StackTop.WorldState, StackTop.TaskNetwork->GetMemory()) >= BestCost)
		{
			if(!bDepthFirstSearch)
			{
				// everything remaining in the heap will be at least as bad, and maybe worse
				PlanningStack.Empty();
				NumStackElements = 0;
			}

//.........这里部分代码省略.........
开发者ID:DennisSoemers,项目名称:HTN_Plan_Reuse,代码行数:101,代码来源:HTNPlannerComponent.cpp

示例2: GetTotalMilliseconds

float UKismetMathLibrary::GetTotalMilliseconds( FTimespan A )
{
	return A.GetTotalMilliseconds();
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:4,代码来源:KismetMathLibrary.cpp

示例3: HandleVirtualTouchInput

void AUISurfaceActor::HandleVirtualTouchInput(FVector ActionHandPalmLocation, FVector ActionHandFingerLocation) {
	FVector ActorSpaceActionFingerLocation = this->GetTransform().InverseTransformPosition(ActionHandFingerLocation);
	FVector ActorSpaceActionPalmLocation = this->GetTransform().InverseTransformPosition(ActionHandPalmLocation);
	FVector ActorSpaceActionFingerPreviousLocation = this->GetTransform().InverseTransformPosition(ActionHandPreviousFingerLocation);
	FVector ActorSpaceActionPalmPreviousLocation = this->GetTransform().InverseTransformPosition(ActionHandPreviousPalmLocation);
	FVector ActorSpaceActionFingerLocationXY = ActorSpaceActionFingerLocation;
	ActorSpaceActionFingerLocationXY.Z = 0.0;
	FVector ActorSpacePointerFingerLocationXYWorld = this->GetTransform().TransformPosition(ActorSpaceActionFingerLocationXY);
	FVector PointerFingerPixelCoordinates = GetViewPixelCoordinatesFromActorLocation(ActorSpaceActionFingerLocationXY);
	if (ActorSpaceActionFingerLocation.Z <= 0) { // finger is across plane
		if (!PointerFingerAcrossPlane) { // finger was not previously across plane, so handle as mouse click and set across flag to true
			HandleMouseDownEventAtCoordinates(PointerFingerPixelCoordinates);
			DrawDebugSphere(GetWorld(), ActorSpacePointerFingerLocationXYWorld, 0.6, 12, FColor::Cyan, true, 0.1);
			PointerFingerAcrossPlane = true;
		}
		else { // was already across plane
		}
		// handle scrolling
		FVector CurrentPalmPixelCoordinates = GetViewPixelCoordinatesFromActorLocation(ActorSpaceActionPalmLocation);
		FVector PreviousPalmPixelCoordinates = GetViewPixelCoordinatesFromActorLocation(ActorSpaceActionPalmPreviousLocation);
		float NumPixelsMovedY = CurrentPalmPixelCoordinates.Y - PreviousPalmPixelCoordinates.Y; // if negative means palm is moving up so should scroll down
		if (abs(NumPixelsMovedY) >= ScrollNumPixelsThreshold) {
			float WheelTicksY = NumPixelsMovedY / PixelToWheelTickScalingFactor;
			HandleYScrollIncrementEvent(WheelTicksY);
		}
		// Handle left/right swipe
		// NOTE: was a simple left swipe to go Back before, but since there were too many false positives have more complicated gesture linking left and right swipes to go Back
		float NumPixelsMovedX = CurrentPalmPixelCoordinates.X - PreviousPalmPixelCoordinates.X; 
		if (abs(NumPixelsMovedX) >= SwipeLengthPixelsThreshold) { 
			FDateTime CurrentTime = FDateTime::Now();
			if (NumPixelsMovedX < 0) { // is left swipe
				FTimespan TimeBetweenLeftSwipes = CurrentTime - LastLeftSwipeTime;
				if (TimeBetweenLeftSwipes.GetTotalMilliseconds() >= MinMillisecondsBetweenSwipes) { // check if there has been enough elapsed time since last swipe
					LastLeftSwipeTime = CurrentTime;
				}
			}
			else { // is right swipe
				FTimespan TimeBetweenRightSwipes = CurrentTime - LastRightSwipeTime;
				if (TimeBetweenRightSwipes.GetTotalMilliseconds() >= MinMillisecondsBetweenSwipes) { // check if there has been enough elapsed time since last swipe
					LastRightSwipeTime = CurrentTime;
					FTimespan TimeBetweenLeftAndRightSwipes = LastRightSwipeTime - LastLeftSwipeTime;
					if (TimeBetweenLeftAndRightSwipes.GetTotalMilliseconds() <= MaxMillisecondsLinkingSwipes) { // check right swipe is linked to the previous left swipe
						HandleBackEvent();
					}
				}
			}
		}
		
	}
	else { // finger is not across plane
		if (PointerFingerAcrossPlane) { // set across flag to false if it was set to true
			PointerFingerAcrossPlane = false ;
			HandleMouseUpEventAtCoordinates(PointerFingerPixelCoordinates);
		}
		// check for hover state
		if (ActorSpaceActionFingerLocation.Z <= this->HoverDistance) { // check for hovering
			PointerFingerIsHovering = true;
			DrawDebugSphere(GetWorld(), ActorSpacePointerFingerLocationXYWorld, 0.5, 12, FColor::Magenta);
			HandleMouseoverEventPixelCoordinates(PointerFingerPixelCoordinates);
		}
		else {
			if (PointerFingerIsHovering) {
				PointerFingerIsHovering = false;
			}
		}
	}
    // Now that we are done with Leap processing let's set the previous hand locations to the current hand locations
    ActionHandPreviousPalmLocation = ActionHandPalmLocation;
    ActionHandPreviousFingerLocation = ActionHandFingerLocation;
}
开发者ID:huylu,项目名称:coherent-ui-virtual-touch,代码行数:70,代码来源:UISurfaceActor.cpp


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