Compare commits

..

No commits in common. "9436d168751a9fd28de97a2683571c3aea8091e2" and "e07abfbcfcab3cd3655157ed34737dea284adefa" have entirely different histories.

4 changed files with 5 additions and 19 deletions

View File

@ -78,14 +78,6 @@ void APickup::OnOuterBeginOverlap(UPrimitiveComponent* OverlappedComponent, AAct
{
PickupLocation = GetActorLocation();
PlayTimeLine();
double dist = FVector::Distance(GetActorLocation(), PlayerCharacter->GetActorLocation());
if (dist < OuterSphereComponent->GetScaledSphereRadius())
{
double ratio = FMath::Abs((dist / OuterSphereComponent->GetScaledSphereRadius()) - 1.0f);
TimelineComponent->SetNewTime(ratio);
}
}
}

View File

@ -36,9 +36,11 @@ void AVampireAIController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (PlayerCharacter)
if (AVampireCharacter* Player = Cast<AVampireCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0)))
{
Blackboard->SetValueAsVector("PlayerLocation", PlayerCharacter->GetActorLocation());
Blackboard->SetValueAsObject("Player", Player);
auto location = Player->GetActorLocation();
Blackboard->SetValueAsVector("PlayerLocation", location);
}
}
@ -52,18 +54,11 @@ void AVampireAIController::OnPossess(APawn* InPawn)
EnemyCharacter->GetHealthComponent()->OnDamaged.AddDynamic(this, &AVampireAIController::OnDamaged);
EnemyCharacter->GetHealthComponent()->OnDeath.AddDynamic(this, &AVampireAIController::OnDeath);
PlayerCharacter = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);
if (UBehaviorTree* bt = EnemyCharacter->GetBehaviorTree())
{
Blackboard->InitializeBlackboard(*bt->BlackboardAsset);
BehaviorTree->StartTree(*bt);
Blackboard->SetValueAsObject("SelfActor", EnemyCharacter);
if (PlayerCharacter)
{
Blackboard->SetValueAsObject("Player", PlayerCharacter);
}
}
}

View File

@ -22,7 +22,7 @@ class VAMPIRES_API AVampireAIController : public AAIController
UBehaviorTreeComponent* BehaviorTree;
ACharacter* PlayerCharacter;
APlayerCharacter* PlayerCharacter;
AEnemyCharacter* EnemyCharacter;

View File

@ -27,7 +27,6 @@ class VAMPIRES_API AGarlicWeapon : public AWeapon
{
GENERATED_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
USphereComponent* SphereComponent;
TArray<FOverlappedEnemy> OverlappedEnemies;