Compare commits

..

No commits in common. "5e0433905f236b1f425760bbee94486ea0f4cec8" and "ba0243bd6516c12e50376bebb20a4bd8ec80d6dd" have entirely different histories.

5 changed files with 1 additions and 31 deletions

View File

@ -8,8 +8,6 @@
#include "BehaviorTree/BehaviorTree.h" #include "BehaviorTree/BehaviorTree.h"
#include "BehaviorTree/BlackboardComponent.h" #include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/BlackboardData.h" #include "BehaviorTree/BlackboardData.h"
#include "Kismet/GameplayStatics.h"
#include "Kismet/KismetMathLibrary.h"
#include "UI/EnemyHealthbarUserWidget.h" #include "UI/EnemyHealthbarUserWidget.h"
#define COLLISION_WEAPON ECC_GameTraceChannel1 #define COLLISION_WEAPON ECC_GameTraceChannel1
@ -80,23 +78,6 @@ void AEnemyCharacter::BeginPlay()
} }
} }
void AEnemyCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
if (PlayerCharacter && HealthbarWidgetComponent->GetWidget())
{
FVector ActorLocation = GetActorLocation();
UCameraComponent* PlayerCamera = PlayerCharacter->GetCameraComponent();
FVector PlayerLocation = PlayerCamera->GetComponentTransform().GetLocation();
FRotator rotation = UKismetMathLibrary::FindLookAtRotation(ActorLocation, PlayerLocation);
HealthbarWidgetComponent->SetWorldRotation(rotation);
}
}
void AEnemyCharacter::PlayOnFireAnimations() void AEnemyCharacter::PlayOnFireAnimations()
{ {
Super::PlayOnFireAnimations(); Super::PlayOnFireAnimations();

View File

@ -53,9 +53,6 @@ public:
protected: protected:
virtual void BeginPlay() override; virtual void BeginPlay() override;
public:
virtual void Tick(float DeltaTime) override;
private: private:
virtual void PlayOnFireAnimations() override; virtual void PlayOnFireAnimations() override;

View File

@ -826,8 +826,3 @@ void APlayerCharacter::SetIsThrowing(bool bIsThrowing)
{ {
IsThrowing = bIsThrowing; IsThrowing = bIsThrowing;
} }
UCameraComponent* APlayerCharacter::GetCameraComponent()
{
return CameraComponent;
}

View File

@ -242,8 +242,6 @@ public:
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetIsThrowing(bool bIsThrowing); void SetIsThrowing(bool bIsThrowing);
UCameraComponent* GetCameraComponent();
protected: protected:
virtual void CalculateHits(TArray<FHitResult>* hits, FVector* dir) override; virtual void CalculateHits(TArray<FHitResult>* hits, FVector* dir) override;

View File

@ -12,8 +12,7 @@ void UEnemyHealthbarUserWidget::BindOwner(AEnemyCharacter* NewOwner)
if (Owner) if (Owner)
{ {
auto healthComponent = Owner->GetHealthComponent(); auto healthComponent = Owner->GetHealthComponent();
healthComponent->OnDamaged.BindUFunction(this, "UpdateHealthbar"); healthComponent->OnDamaged.BindUFunction(this, "UpdateHealthbar");
UpdateHealthbar();
} }
} }