void UPawnActionsComponent::DescribeSelfToVisLog(FVisualLogEntry* Snapshot) const { static const FString Category = TEXT("PawnActions"); if (IsPendingKill()) { return; } for (int32 PriorityIndex = 0; PriorityIndex < ActionStacks.Num(); ++PriorityIndex) { const UPawnAction* Action = ActionStacks[PriorityIndex].GetTop(); if (Action == NULL) { continue; } FVisualLogStatusCategory StatusCategory; StatusCategory.Category = Category + TEXT(": ") + GetPriorityName(PriorityIndex); while (Action) { StatusCategory.Add(Action->GetName(), Action->GetStateDescription()); Action = Action->GetParentAction(); } Snapshot->Status.Add(StatusCategory); } }
bool UPawnAction::Activate() { bool bResult = false; UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> Activating at priority %s! First start? %s Paused? %s") , *GetName() , *GetPriorityName() , HasBeenStarted() ? TEXT("NO") : TEXT("YES") , IsPaused() ? TEXT("YES") : TEXT("NO")); if (HasBeenStarted() && IsPaused()) { bResult = Resume(); } else { bResult = Start(); if (bResult == false) { UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> Failed to start.") , *GetName()); bFailedToStart = true; SetFinishResult(EPawnActionResult::Failed); SendEvent(EPawnActionEventType::FailedToStart); } } return bResult; }
void UPawnAction::OnPushed() { IndexOnStack = 0; UPawnAction* PrevAction = ParentAction; while (PrevAction) { ++IndexOnStack; PrevAction = PrevAction->ParentAction; } UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> Pushed with priority %s, IndexOnStack: %d, instigator %s") , *GetName(), *GetPriorityName(), IndexOnStack, *GetNameSafe(Instigator)); }