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.
130 lines
3.2 KiB
130 lines
3.2 KiB
// 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<AUnit> 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<UWidgetComponent> 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<UAnimMontage*> MeleeMontage;
|
|
|
|
UPROPERTY(BlueprintReadWrite, Category="Animations")
|
|
TArray<UAnimMontage*> RangedMontage;
|
|
|
|
UPROPERTY(BlueprintReadWrite, Category="Animations")
|
|
TArray<UAnimMontage*> WeaponMontage;
|
|
|
|
UPROPERTY(BlueprintReadWrite, Category="Animations")
|
|
TArray<UAnimMontage*> DeathMontage;
|
|
|
|
UPROPERTY(BlueprintReadWrite)
|
|
float DamageNumberSpeed = 100.0f;
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
|
TArray<TSubclassOf<ABasicProjectile>> 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;
|
|
};
|