本文整理汇总了C++中APlayerController::GetHUD方法的典型用法代码示例。如果您正苦于以下问题:C++ APlayerController::GetHUD方法的具体用法?C++ APlayerController::GetHUD怎么用?C++ APlayerController::GetHUD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APlayerController
的用法示例。
在下文中一共展示了APlayerController::GetHUD方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToggleInventory
void AAvatar::ToggleInventory()
{
APlayerController* PController = GetWorld()->GetFirstPlayerController();
AMyHUD* hud = Cast<AMyHUD>( PController->GetHUD() );
// If inventory is displayed, undisplay it.
if( inventoryShowing )
{
hud->clearWidgets();
inventoryShowing = false;
PController->bShowMouseCursor = false;
return;
}
// Otherwise, display the player's inventory
inventoryShowing = true;
PController->bShowMouseCursor = true;
for( TMap<FString,int>::TIterator it = Backpack.CreateIterator(); it; ++it )
{
// Combine string name of the item, with qty eg Cow x 5
FString fs = it->Key + FString::Printf( TEXT(" x %d"), it->Value );
UTexture2D* tex = NULL;
if( Icons.Find( it->Key ) )
{
tex = Icons[it->Key];
Widget w( Icon( fs, tex ), Classes[it->Key] );
w.bpSpell = Spells[it->Key];
hud->addWidget( w );
}
}
}
示例2: Prox_Implementation
void APickUpItem::Prox_Implementation(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32
OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
// if the overlapped actor is NOT the player,
// you simply should return
if (Cast<AActor>(OtherActor) == nullptr)
{
return;
}
// Get a reference to the player avatar, to give him
// the item
AAvatar *avatar = Cast<AAvatar>(UGameplayStatics::GetPlayerPawn(
GetWorld(), 0));
// Let the player pick up item
// Notice use of keyword this!
// That is how _this_ Pickup can refer to itself.
avatar->Pickup(this);
if (CoinSound != NULL)
{
UGameplayStatics::PlaySoundAtLocation(this, CoinSound, GetActorLocation());
}
// Get a reference to the controller
APlayerController* PController = GetWorld() ->GetFirstPlayerController();
// Get a reference to the HUD from the controller
AMyHUD* hud = Cast<AMyHUD>(PController->GetHUD());
hud->addMessage(Message(Icon, FString("Picked up ") + FString(" ") + Name + FString(" ")+FString::FromInt(Quantity), 2.0f, FColor::Black, FColor::Black));
Destroy();
}
示例3: FindLockedDebugActor
void FBehaviorTreeDebugger::FindLockedDebugActor(UWorld* World)
{
APlayerController* LocalPC = GEngine->GetFirstLocalPlayerController(World);
if (LocalPC && LocalPC->GetHUD() && LocalPC->GetPawnOrSpectator())
{
AGameplayDebuggingReplicator* DebuggingReplicator = NULL;
for (TActorIterator<AGameplayDebuggingReplicator> It(World); It; ++It)
{
AGameplayDebuggingReplicator* A = *It;
if (!A->IsPendingKill())
{
DebuggingReplicator = A;
break;
}
}
const APawn* LockedPawn = DebuggingReplicator != NULL ? Cast<APawn>(DebuggingReplicator->GetSelectedActorToDebug()) : NULL;
UBehaviorTreeComponent* TestInstance = FindInstanceInActor((APawn*)LockedPawn);
if (TestInstance)
{
TreeInstance = TestInstance;
#if USE_BEHAVIORTREE_DEBUGGER
ActiveStepIndex = TestInstance->DebuggerSteps.Num() - 1;
#endif
}
}
}
示例4: MouseRightClicked
void AAvatar::MouseRightClicked()
{
if( inventoryShowing )
{
APlayerController* PController = GetWorld()->GetFirstPlayerController();
AMyHUD* hud = Cast<AMyHUD>( PController->GetHUD() );
hud->MouseRightClicked();
}
}
示例5: Prox_Implementation
void ALearningCPPNPC::Prox_Implementation(AActor* OtherActor, UPrimitiveComponent* OtherComponent, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (Cast<ALearningCPPCharacter>(OtherActor) == nullptr) return;
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
if (PlayerController)
{
ALearningCPPHUD* Hud = Cast<ALearningCPPHUD>(PlayerController->GetHUD());
Hud->AddMessage(FMessage(NpcName + ": " + NpcMessage, 3.0f, FColor::White, Texture));
}
}
示例6: LMB_Out
void APawnWithCamera::LMB_Out()
{
APlayerController* MyController = GetWorld()->GetFirstPlayerController();
AMyHUD *Hudref = Cast<AMyHUD>(MyController->GetHUD());
FVector WorldMousePos = Hudref->GetMOuseWorldPosition();
FVector Start = GetActorLocation();
DistanceWithToPoints = FVector::Dist(Start, WorldMousePos);
//DrawDebugSphere(GetWorld(), WorldMousePos, 16.f, 8, FColor(83, 155, 83, 255), false, 0.15f);
DrawDebugLine(GetWorld(), Start, WorldMousePos, FColor(255, 0, 0), true, 0.5f, 0, 5.0f);
}
示例7: Prox_Implementation
void ANPCDialogue::Prox_Implementation(AActor* otherActor, UPrimitiveComponent*
otherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
if (Cast<AFPSHorrorCharacter>(otherActor) == nullptr)
{
return;
}
APlayerController* PController = GetWorld()->GetFirstPlayerController();
if (PController)
{
AMyHUD* hud = Cast<AMyHUD>(PController->GetHUD());
hud->addMessage(FMessage(NPCmessage, 5.0f, FColor::White));
}
}
示例8: Pitch
void AAvatar::Pitch( float amount )
{
//y
if( inventoryShowing )
{
// if the button is down click drag
APlayerController* PController = GetWorld()->GetFirstPlayerController();
AMyHUD* hud = Cast<AMyHUD>( PController->GetHUD() );
hud->MouseMoved();
}
//else
{
AddControllerPitchInput(200.f*amount * GetWorld()->GetDeltaSeconds());
}
}
示例9: Prox_Implementation
void ANPC::Prox_Implementation(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (Cast<AAvatar>(OtherActor) == nullptr) { return; }
APlayerController* PController = GetWorld()->GetFirstPlayerController();
if (PController)
{
ANPC_HUD* hud = Cast<ANPC_HUD>(PController->GetHUD());
FString NameAndMessage = FString::Printf(TEXT("%s: %s"), *Name, *NPCMessage);
hud->AddMessage(Message(NameAndMessage, 5.f, FColor::White, Face));
hp->is_visible = true;
hud->AddHpBar(hp);
}
}
示例10: TickComponent
// Called every frame
void UHealthBar::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) {
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
if (health == -1) {
APlayerController* PC = UGameplayStatics::GetPlayerController(this, 0);
if (PC) {
ACCHUD* hud = Cast<ACCHUD>(PC->GetHUD());
if (hud) {
hud->RegisterHealthbar(this);
health = maxHealth;
}
}
} else {
//health -= 0.01;
}
}
示例11: OnDrop_Implementation
void ANotePickup::OnDrop_Implementation()
{
Super::OnDrop_Implementation();
APlayerController* c = GetWorld()->GetFirstPlayerController();
if (c)
{
ACharacterHUD* h = Cast<ACharacterHUD>(c->GetHUD());
if (h)
{
h->DrawNoteString = false;
h->DrawNoteImage = false;
h->NoteString = "";
Fade = -1.0;
}
}
}
示例12: Tick
void ANotePickup::Tick(float DeltaTime)
{
if (Fade != 0)
{
APlayerController* c = GetWorld()->GetFirstPlayerController();
if (c)
{
ACharacterHUD* h = Cast<ACharacterHUD>(c->GetHUD());
if (h)
{
h->BlackBackgroundAlpha = FMath::Clamp(h->BlackBackgroundAlpha + (200 * DeltaTime * Fade), 0.0f, 150.0f);
if (h->BlackBackgroundAlpha == 0.0f || h->BlackBackgroundAlpha == 150)
Fade = 0;
}
}
}
}
示例13: ConsumeFood
void ASCharacter::ConsumeFood(float AmountRestored)
{
// Reduce Hunger, ensure we do not go outside of our bounds
Hunger = FMath::Clamp(Hunger - AmountRestored, 0.0f, GetMaxHunger());
// Restore Hitpoints
Health = FMath::Clamp(Health + AmountRestored, 0.0f, GetMaxHealth());
APlayerController* PC = Cast<APlayerController>(Controller);
if (PC)
{
ASHUD* MyHUD = Cast<ASHUD>(PC->GetHUD());
if (MyHUD)
{
MyHUD->MessageReceived("Food consumed!");
}
}
}
示例14: Read
void ANotePickup::Read()
{
APlayerController* c = GetWorld()->GetFirstPlayerController();
if (c)
{
ACharacterHUD* h = Cast<ACharacterHUD>(c->GetHUD());
if (h)
{
h->DrawNoteString = !h->DrawNoteString;
h->DrawSafeString = false;
h->NoteString = Notes[NoteIndex];
h->NoteImage = NoteImage;
h->DrawNoteImage = !h->DrawNoteImage;
if (h->DrawNoteString)
Fade = 1.0;
else
Fade = -1.0;
}
}
}
示例15: PyErr_Format
PyObject *py_ue_get_player_hud(ue_PyUObject *self, PyObject * args)
{
ue_py_check(self);
int controller_id = 0;
if (!PyArg_ParseTuple(args, "|i:get_player_hud", &controller_id))
{
return NULL;
}
UWorld *world = ue_get_uworld(self);
if (!world)
return PyErr_Format(PyExc_Exception, "unable to retrieve UWorld from uobject");
APlayerController *controller = UGameplayStatics::GetPlayerController(world, controller_id);
if (!controller)
return PyErr_Format(PyExc_Exception, "unable to retrieve controller %d", controller_id);
Py_RETURN_UOBJECT(controller->GetHUD());
}