Add AI Service for Variable Speed Changes
This commit is contained in:
parent
df7ca8b0db
commit
b6fd4e0d75
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BP_BasicEnemyCharacter.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BP_BasicEnemyCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BT_BasicEnemy.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/AI/Enemy/Basic/BT_BasicEnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/EnemyAITest/B/AZ/GX8EY01G00J28SE17R0FJV.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/__ExternalActors__/Levels/EnemyAITest/B/AZ/GX8EY01G00J28SE17R0FJV.uasset
(Stored with Git LFS)
Binary file not shown.
@ -0,0 +1,26 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "BTService_ChangeSpeed.h"
|
||||||
|
|
||||||
|
#include "EndlessVendetta/AI/AI_EnemyController.h"
|
||||||
|
#include "EndlessVendetta/AI/EnemyCharacter.h"
|
||||||
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
|
|
||||||
|
UBTService_ChangeSpeed::UBTService_ChangeSpeed()
|
||||||
|
{
|
||||||
|
bNotifyBecomeRelevant = true;
|
||||||
|
NodeName = TEXT("Change Speed");
|
||||||
|
}
|
||||||
|
|
||||||
|
void UBTService_ChangeSpeed::OnBecomeRelevant(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
|
||||||
|
{
|
||||||
|
Super::OnBecomeRelevant(OwnerComp, NodeMemory);
|
||||||
|
if (const AAI_EnemyController* const EnemyController = Cast<AAI_EnemyController>(OwnerComp.GetAIOwner()))
|
||||||
|
{
|
||||||
|
if (const AEnemyCharacter* const EnemyCharacter = Cast<AEnemyCharacter>(EnemyController->GetPawn()))
|
||||||
|
{
|
||||||
|
EnemyCharacter->GetCharacterMovement()->MaxWalkSpeed = Speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "BehaviorTree/Services/BTService_BlackboardBase.h"
|
||||||
|
#include "BTService_ChangeSpeed.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class ENDLESSVENDETTA_API UBTService_ChangeSpeed : public UBTService_BlackboardBase
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
UBTService_ChangeSpeed();
|
||||||
|
virtual void OnBecomeRelevant(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI", meta = (AllowPrivateAccess = "true"))
|
||||||
|
float Speed = 600.0f;
|
||||||
|
};
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
UBTTask_AttackPlayer::UBTTask_AttackPlayer(FObjectInitializer const& ObjectInitializer)
|
UBTTask_AttackPlayer::UBTTask_AttackPlayer(FObjectInitializer const& ObjectInitializer)
|
||||||
{
|
{
|
||||||
|
NodeName = TEXT("Attack Player");
|
||||||
}
|
}
|
||||||
|
|
||||||
EBTNodeResult::Type UBTTask_AttackPlayer::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
|
EBTNodeResult::Type UBTTask_AttackPlayer::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
|
||||||
|
Loading…
Reference in New Issue
Block a user