Fixed typo

Renamed "lifes" by "lives"
This commit is contained in:
JKuijperM 2023-04-08 13:58:57 +02:00
parent 9065d2f778
commit aa724c3e56
5 changed files with 35 additions and 24 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:10ece340b018b0e878987dffa865dd97ac886a09d1aec849a25b82c59ea5e718
size 44069
oid sha256:7e8104ca75816a6d60ace1e793d5e2822ce9ada1bd7ea52e10c3564325438f9f
size 70602

View File

@ -15,7 +15,8 @@ ATile::ATile()
PrimaryActorTick.bCanEverTick = true;
// Add scene component
SceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Scene"));
SceneComponent->SetupAttachment(RootComponent);
RootComponent = SceneComponent;
//SceneComponent->SetupAttachment(RootComponent);
// Add arrow component like attach point
ArrowComponent = CreateDefaultSubobject<UArrowComponent>(TEXT("AttachPoint"));
ArrowComponent->SetupAttachment(SceneComponent);

View File

@ -215,11 +215,11 @@ void AZombieCharacter::ObstacleCollision()
if (CurrentGameMode->iPlayerLife > 0)
{
PlayFlashEffect();
ZombieHUD->ModifyLifeCounter();
ZombieHUD->ModifyLiveCounter();
}
else
{
ZombieHUD->ModifyLifeCounter();
ZombieHUD->ModifyLiveCounter();
Die();
}
}

View File

@ -13,33 +13,43 @@ void UZombiePlayerHUD::NativeConstruct()
// ItemTitle can be nullptr if we haven't created it in the
// Blueprint subclass
if (TextLife)
if (TextLive)
{
TextLife->SetText(FText::FromString(TEXT("Lifes: ")));
TextLive->SetText(FText::FromString(TEXT("Lives: ")));
}
if (LifeImg01)
if (LiveImg01)
{
LifeImg01->SetBrushFromTexture(LifeGreenTexture);
LiveImg01->SetBrushFromTexture(LiveGreenTexture);
}
if (LiveImg02)
{
LiveImg02->SetBrushFromTexture(LiveGreenTexture);
}
if (LiveImg03)
{
LiveImg03->SetBrushFromTexture(LiveGreenTexture);
}
CurrentGameMode = Cast<AEndlessZombieGameMode>(UGameplayStatics::GetGameMode(GetWorld()));
}
void UZombiePlayerHUD::ModifyLifeCounter()
void UZombiePlayerHUD::ModifyLiveCounter()
{
if (CurrentGameMode)
{
switch (CurrentGameMode->iPlayerLife)
{
case 2:
EmptyLife(LifeImg03);
EmptyLive(LiveImg03);
break;
case 1:
EmptyLife(LifeImg02);
EmptyLive(LiveImg02);
break;
case 0:
EmptyLife(LifeImg01);
EmptyLive(LiveImg01);
break;
default:
break;
@ -48,10 +58,10 @@ void UZombiePlayerHUD::ModifyLifeCounter()
}
void UZombiePlayerHUD::EmptyLife(UImage* LifeImg)
void UZombiePlayerHUD::EmptyLive(UImage* LiveImg)
{
if ((LifeImg) && (LifeGreyTexture))
if ((LiveImg) && (LiveGreyTexture))
{
LifeImg->SetBrushFromTexture(LifeGreyTexture);
LiveImg->SetBrushFromTexture(LiveGreyTexture);
}
}

View File

@ -22,22 +22,22 @@ protected:
public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* TextLife;
UTextBlock* TextLive;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UImage* LifeImg01;
UImage* LiveImg01;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UImage* LifeImg02;
UImage* LiveImg02;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UImage* LifeImg03;
UImage* LiveImg03;
UPROPERTY(EditAnywhere)
UTexture2D* LifeGreenTexture;
UTexture2D* LiveGreenTexture;
UPROPERTY(EditAnywhere)
UTexture2D* LifeGreyTexture;
UTexture2D* LiveGreyTexture;
AEndlessZombieGameMode* CurrentGameMode;
void ModifyLifeCounter();
void ModifyLiveCounter();
private:
void EmptyLife(UImage* LifeImg);
void EmptyLive(UImage* LiveImg);
};