diff --git a/Content/HUD/WB_ZombiePlayerHUD.uasset b/Content/HUD/WB_ZombiePlayerHUD.uasset index 63c6fb2..ecb7a22 100644 --- a/Content/HUD/WB_ZombiePlayerHUD.uasset +++ b/Content/HUD/WB_ZombiePlayerHUD.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:10ece340b018b0e878987dffa865dd97ac886a09d1aec849a25b82c59ea5e718 -size 44069 +oid sha256:7e8104ca75816a6d60ace1e793d5e2822ce9ada1bd7ea52e10c3564325438f9f +size 70602 diff --git a/Source/EndlessZombie/Tile.cpp b/Source/EndlessZombie/Tile.cpp index 8a694c7..91b75a7 100644 --- a/Source/EndlessZombie/Tile.cpp +++ b/Source/EndlessZombie/Tile.cpp @@ -15,7 +15,8 @@ ATile::ATile() PrimaryActorTick.bCanEverTick = true; // Add scene component SceneComponent = CreateDefaultSubobject(TEXT("Scene")); - SceneComponent->SetupAttachment(RootComponent); + RootComponent = SceneComponent; + //SceneComponent->SetupAttachment(RootComponent); // Add arrow component like attach point ArrowComponent = CreateDefaultSubobject(TEXT("AttachPoint")); ArrowComponent->SetupAttachment(SceneComponent); diff --git a/Source/EndlessZombie/ZombieCharacter.cpp b/Source/EndlessZombie/ZombieCharacter.cpp index f595dfd..99895e2 100644 --- a/Source/EndlessZombie/ZombieCharacter.cpp +++ b/Source/EndlessZombie/ZombieCharacter.cpp @@ -215,11 +215,11 @@ void AZombieCharacter::ObstacleCollision() if (CurrentGameMode->iPlayerLife > 0) { PlayFlashEffect(); - ZombieHUD->ModifyLifeCounter(); + ZombieHUD->ModifyLiveCounter(); } else { - ZombieHUD->ModifyLifeCounter(); + ZombieHUD->ModifyLiveCounter(); Die(); } } diff --git a/Source/EndlessZombie/ZombiePlayerHUD.cpp b/Source/EndlessZombie/ZombiePlayerHUD.cpp index 6c9f125..64bfa8e 100644 --- a/Source/EndlessZombie/ZombiePlayerHUD.cpp +++ b/Source/EndlessZombie/ZombiePlayerHUD.cpp @@ -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(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); } } diff --git a/Source/EndlessZombie/ZombiePlayerHUD.h b/Source/EndlessZombie/ZombiePlayerHUD.h index 610d173..85631b1 100644 --- a/Source/EndlessZombie/ZombiePlayerHUD.h +++ b/Source/EndlessZombie/ZombiePlayerHUD.h @@ -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); };