You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.2 KiB
97 lines
3.2 KiB
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Character.h"
|
|
#include "GameplayTagAssetInterfacE.h"
|
|
|
|
#include "MAICharacterBase.generated.h"
|
|
|
|
class UMHealthComponent;
|
|
class UWidgetComponent;
|
|
class AMGameplayActor;
|
|
class FOnCharacterEnterSafeZone;
|
|
class AMAICharacterBase;
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnAIEnterSafeZone, AMAICharacterBase*, AICharacter, AActor*, SafeZoneEnteredActor);
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAILeaveSafeZone, AMAICharacterBase*, AICharacter);
|
|
|
|
UCLASS()
|
|
class MECHDEFENCE_API AMAICharacterBase : public ACharacter, public IGameplayTagAssetInterface
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
AMAICharacterBase();
|
|
|
|
protected:
|
|
|
|
bool bIsInSafeZone;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "AICharacter SafeZone")
|
|
FGameplayTagContainer SafeZoneTags;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "AICharacter SafeZone")
|
|
TSubclassOf<AActor> SafeZoneClass;
|
|
|
|
UPROPERTY(EditDefaultsOnly, Category = "Tags")
|
|
FGameplayTagContainer ActorTags;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "AICharacter Base")
|
|
UWidgetComponent* StatusIndicatorWidget;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "AICharacter Base")
|
|
UMHealthComponent* HealthComponent;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "AICharacter Base")
|
|
UParticleSystem* DefaultHitParticle;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "AICharacter Base")
|
|
UParticleSystem* VulnerableHitParticle;
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
virtual UShapeComponent* GetSafeZoneOverlappingShape();
|
|
|
|
virtual void BeginPlay() override;
|
|
void SetWidgetHealthComponentProperty();
|
|
|
|
public:
|
|
virtual void Tick(float DeltaTime) override;
|
|
|
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "AICharacter Events")
|
|
FOnAIEnterSafeZone OnAIEnterSafeZone;
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "AICharacter Events")
|
|
FOnAILeaveSafeZone OnAILeaveSafeZone;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "AICharacter")
|
|
void AddGameplayTags(const FGameplayTagContainer& TagContainer);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "AICharacter")
|
|
void AddGameplayTag(const FGameplayTag& Tag);
|
|
|
|
void LeaveSafeZone();
|
|
void EnterSafeZone(AActor* SafeZoneActor);
|
|
void CheckSafeZone();
|
|
|
|
bool IsInSafeZone() const { return bIsInSafeZone; }
|
|
|
|
UParticleSystem* GetVulnerableHitParticle() const { return VulnerableHitParticle; }
|
|
UParticleSystem* GetDefaultHitParticle() const { return DefaultHitParticle; }
|
|
|
|
private:
|
|
virtual void GetOwnedGameplayTags(FGameplayTagContainer& TagContainer) const override;
|
|
|
|
UFUNCTION()
|
|
void HandleSafeZoneBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
|
|
|
|
UFUNCTION()
|
|
void HandleSafeZoneEndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
|
|
|
|
UFUNCTION()
|
|
void HandleCharacterDeath(UMHealthComponent* ActorHealthComponent, AActor* DeadActor, AActor* KillerActor);
|
|
|
|
};
|
|
|