本文整理汇总了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;
}
//.........这里部分代码省略.........
示例2: GetTotalMilliseconds
float UKismetMathLibrary::GetTotalMilliseconds( FTimespan A )
{
return A.GetTotalMilliseconds();
}
示例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;
}