Esempio n. 1
0
void ATankAIController::BeginPlay()
{
	Super::BeginPlay();

	ATank* tank = GetPlayerTank();
	if (!tank)
	{
		UE_LOG(LogTemp, Warning, TEXT("No controlled tank for this controller"));
	}
	else
	{
		FString name = tank->GetName();
		UE_LOG(LogTemp, Warning, TEXT("We are now controlling tank: %s"), *name);
	}

}
void ATankAIController::BeginPlay() {
	Super::BeginPlay();

	ATank* ThisTank = GetControlledTank();

	if (!ThisTank)
	{
		GEngine->AddOnScreenDebugMessage(-1, 20.f, FColor::Red, TEXT("[TAIC] AI Tank not found"));
	}

	ATank* PlayerTank = GetPlayerTank();

	if (PlayerTank) {
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("[TAIC] Player Tank %s found!"), *PlayerTank->GetName()));
	}
	else
	{
		GEngine->AddOnScreenDebugMessage(-1, 20.f, FColor::Red, TEXT("[TAIC] Player Tank not found"));
	}
}