// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "BasicProjectile.h" #include "Components/ArrowComponent.h" #include "Components/WidgetComponent.h" #include "GameFramework/Character.h" #include "Unit.generated.h" UCLASS() class STREETPUNKZ_API AUnit : public ACharacter { GENERATED_BODY() public: // Sets default values for this character's properties AUnit(); protected: // Called when the game starts or when spawned virtual void BeginPlay() override; UPROPERTY(BlueprintReadOnly) TObjectPtr TargetUnit; UFUNCTION(BlueprintNativeEvent) void OnDeath(); public: // Called every frame virtual void Tick(float DeltaTime) override; // Called to bind functionality to input virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; FVector DamageNumbersOriginalPosition; UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Visuals") TObjectPtr DamageNumberWidget; UPROPERTY(BlueprintReadWrite, EditAnywhere) int32 DamageNumberValue; UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Loot") int32 XP = 1; UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Loot") int32 Money = 1; UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Loot") int32 DifficultyValue = 1; UPROPERTY(BlueprintReadWrite, Category="Stats") float MaxHP = 80; UPROPERTY(BlueprintReadWrite, Category="Stats") float HP = 80; UPROPERTY(BlueprintReadWrite, Category="Stats") float Attack = 1; UPROPERTY(BlueprintReadWrite, Category="Stats") float Defense = 1; UPROPERTY(BlueprintReadWrite, Category="Stats") float Dexterity = 1; UPROPERTY(BlueprintReadWrite, Category="Stats") float Range = 180.0f; UPROPERTY(BlueprintReadWrite, Category="Stats") float Cooldown = 3.0f; UPROPERTY(BlueprintReadWrite, Category="Stats") float CooldownTimer; UPROPERTY(BlueprintReadWrite, Category="Stats") float ProjectileSpeed = 5000.0f; UPROPERTY(BlueprintReadWrite, Category="Animations") TArray MeleeMontage; UPROPERTY(BlueprintReadWrite, Category="Animations") TArray RangedMontage; UPROPERTY(BlueprintReadWrite, Category="Animations") TArray WeaponMontage; UPROPERTY(BlueprintReadWrite, Category="Animations") TArray DeathMontage; UPROPERTY(BlueprintReadWrite) float DamageNumberSpeed = 100.0f; UPROPERTY(BlueprintReadWrite, EditAnywhere) TArray> ProjectileClasses; UPROPERTY(BlueprintReadWrite, EditAnywhere) UArrowComponent* ProjectileSpawnPoint; UPROPERTY(BlueprintReadOnly) bool WasAliveLastFrame = true; UFUNCTION(BlueprintCallable) void ApplyMeleeDamage(); UFUNCTION(BlueprintCallable) void LaunchProjectileSignal(); UFUNCTION(BlueprintCallable) void SetTarget(AUnit* InTarget); UFUNCTION(BlueprintCallable) AUnit* FindNearestEnemy(); UFUNCTION(BlueprintCallable) bool IsDead() const; UFUNCTION(BlueprintImplementableEvent) void EventMiss(); UFUNCTION() void ApplyStats(); virtual float TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser) override; void HideDamageNumbers() const; };