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


C++ APlayerController::GetHUD方法代码示例

本文整理汇总了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 );
		}
	}
}
开发者ID:phillzz,项目名称:GoldenEgg,代码行数:31,代码来源:Avatar.cpp

示例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();

	
}
开发者ID:dschmidl,项目名称:GE_Project,代码行数:31,代码来源:PickUpItem.cpp

示例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
		}
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:28,代码来源:BehaviorTreeDebugger.cpp

示例4: MouseRightClicked

void AAvatar::MouseRightClicked()
{
	if( inventoryShowing )
	{
		APlayerController* PController = GetWorld()->GetFirstPlayerController();
		AMyHUD* hud = Cast<AMyHUD>( PController->GetHUD() );
		hud->MouseRightClicked();
	}
}
开发者ID:phillzz,项目名称:GoldenEgg,代码行数:9,代码来源:Avatar.cpp

示例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));
	}
}
开发者ID:Suui,项目名称:UE4Tutorials,代码行数:11,代码来源:LearningCPPNPC.cpp

示例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);
}
开发者ID:anteaterho,项目名称:UE4GitTest,代码行数:13,代码来源:PawnWithCamera.cpp

示例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));
	}
}
开发者ID:Rish79,项目名称:FPS-Horror,代码行数:14,代码来源:NPCDialogue.cpp

示例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());
	}
}
开发者ID:phillzz,项目名称:GoldenEgg,代码行数:15,代码来源:Avatar.cpp

示例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);
  }
}
开发者ID:mdurn,项目名称:UnrealSample,代码行数:15,代码来源:NPC.cpp

示例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;
	}
}
开发者ID:Siretu,项目名称:CCUE,代码行数:17,代码来源:HealthBar.cpp

示例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;
		}
	}
}
开发者ID:LamePancake,项目名称:The-Starscape-Shimmer,代码行数:16,代码来源:NotePickup.cpp

示例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;
			}
		}
	}
}
开发者ID:LamePancake,项目名称:The-Starscape-Shimmer,代码行数:18,代码来源:NotePickup.cpp

示例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!");
		}
	}
}
开发者ID:MarcioGeremia,项目名称:EpicSurvivalGameSeries,代码行数:18,代码来源:SCharacter.cpp

示例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;
		}
	}
}
开发者ID:LamePancake,项目名称:The-Starscape-Shimmer,代码行数:21,代码来源:NotePickup.cpp

示例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());
}
开发者ID:20tab,项目名称:UnrealEnginePython,代码行数:21,代码来源:UEPyPlayer.cpp


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