Advertisement
Dieton

Enemy.h

Dec 17th, 2023
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.24 KB | Gaming | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include "CoreMinimal.h"
  6. #include "GameFramework/Character.h"
  7.  
  8. #include "Interfaces/HitInterface.h"
  9. #include "Characters/CharacterTypes.h"
  10.  
  11. #include "Enemy.generated.h"
  12.  
  13. class UAnimMontage;
  14. class UAttributeComponent;
  15. class UHealthBarComponent;
  16.  
  17. UCLASS()
  18. class SLASH_API AEnemy : public ACharacter, public IHitInterface
  19. {
  20.     GENERATED_BODY()
  21.  
  22. public:
  23.     AEnemy();
  24.  
  25.     virtual void Tick(float DeltaTime) override;
  26.     virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
  27.     virtual void GetHit_Implementation(const FVector& ImpactPoint) override;
  28.     void DirectionalHitReact(const FVector& ImpactPoint);
  29.     virtual float TakeDamage(float DamageAmount, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, AActor* DamageCauser) override;
  30.  
  31. private:
  32.  
  33.     UPROPERTY(VisibleAnywhere)
  34.     UAttributeComponent* Attibutes;
  35.  
  36.     UPROPERTY(VisibleAnywhere)
  37.     UHealthBarComponent* HealthBarWidget;
  38.  
  39.     /*
  40.     Animation Montages
  41.     */
  42.     UPROPERTY(EditDefaultsOnly, Category = Montages)
  43.     UAnimMontage* HitReactMontage;
  44.  
  45.     UPROPERTY(EditDefaultsOnly, Category = Montages)
  46.     UAnimMontage* DeathMontage;
  47.  
  48.     UPROPERTY(EditAnywhere, Category = Sounds)
  49.     USoundBase* HitSound;
  50.  
  51.     UPROPERTY(EditAnywhere, Category = VisualEffects)
  52.     UParticleSystem* HitParticles;
  53.  
  54.     UPROPERTY()
  55.     AActor* CombatTarget;
  56.  
  57.     UPROPERTY(EditAnywhere)
  58.     double CombatRadius = 500.f;
  59.  
  60.     /*Navigations*/
  61.  
  62.     UPROPERTY()
  63.     class AAIController* EnemyController;
  64.  
  65.     //Current patrol target
  66.     UPROPERTY(EditInstanceOnly, Category = "AI Navigation")
  67.     AActor* PatrolTarget;
  68.  
  69.     UPROPERTY(EditInstanceOnly, Category = "AI Navigation")
  70.     TArray<AActor*> PatrolTargets;
  71.  
  72.     UPROPERTY(EditAnywhere)
  73.     double PatrollRadius = 200.f;
  74.  
  75.     FTimerHandle PatrolTimer;
  76.     void PatrolTimerFinished();
  77.  
  78. protected:
  79.     virtual void BeginPlay() override;
  80.  
  81.     void Die();
  82.     bool InTargetRange(AActor* Target, double Radius);
  83.     void MoveToTarget(AActor* Target);
  84.     AActor* ChoosePatrolTarget();
  85.  
  86.     /*
  87.     Play Montage Functions
  88.     */
  89.     void PlayerHitReactMontage(const FName& SectionName);
  90.  
  91.     UPROPERTY(BlueprintReadOnly)
  92.     EDeathPose DeathPose = EDeathPose::EDP_Alive;
  93.  
  94. public:
  95.    
  96.  
  97. };
  98.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement