코드 정리 + stats FName구현체

This commit is contained in:
2023-10-08 04:45:12 +09:00
parent deef14d8b5
commit 52e4c37ee5
10 changed files with 217 additions and 283 deletions

Binary file not shown.

Binary file not shown.

BIN
Content/Character/Lb/BP_Lb.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Maps/DevMap.umap (Stored with Git LFS)

Binary file not shown.

View File

@@ -25,39 +25,18 @@ ADefaultPlayerCharacter::ADefaultPlayerCharacter()
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
Camera->SetupAttachment(CameraSpringArm, USpringArmComponent::SocketName);
Health = 0.0f;
HPRegeneration = 0.0f;
HealAndShieldpower = 0.0f;
Armor = 0.0f;
MagicResistance = 0.0f;
Tenacity = 0.0f;
SlowRisist = 0.0f;
AttackSpeed = 0.0f;
AttackDamage = 0.0f;
AbilityPower = 0.0f;
CriticalStrikeChance = 0.0f;
CriticalStrikeDamage = 0.0f;
ArmorPenetration = 0.0f;
MagicPenetration = 0.0f;
LifeSteal = 0.0f;
PhysicalVamp = 0.0f;
Omnivamp = 0.0f;
AbilityHaste = 0.0f;
Mana = 0.0f;
ManaRegeneration = 0.0f;
Energy = 0.0f;
EnergyRegeneration = 0.0f;
AttackRange = 0.0f;
MovementSpeed = 0.0f;
GoldGeneration = 0.0f;
AttackDamageGrowth = 0.0f;
AttackSpeedGrowth = 0.0f;
ArmorGrowth = 0.0f;
MagicResistanceGrowth = 0.0f;
HealthGrowth = 0.0f;
HealthRegenerationGrowth = 0.0f;
ManaGrowth = 0.0f;
ManaRegenerationGrowth = 0.0f;
const UEnum* CharStateEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EStats"), true);
if (!CharStateEnum)
{
UE_LOG(LogTemp, Error, TEXT("EStats Missing"));
return;
}
for (uint8 i = 0; i < (uint8)EStats::SIZE; i++)
DefaultStats.Add(*CharStateEnum->GetNameByValue((uint8)i).ToString(), 0.0f);
for (uint8 i = 0; i < (uint8)CooldownType::SIZE; i++)
CooldownDuration.Add((CooldownType)i, 0.0f);
}
void ADefaultPlayerCharacter::Tick(float DeltaTime)
@@ -104,15 +83,15 @@ float ADefaultPlayerCharacter::TakeDamage_Implementation(float DamageAmount, str
float ADDamageMultiplier = 0;
float APDamageMultiplier = 0;
if (MyState->Stats.Armor >= 0)
ADDamageMultiplier = 100 / (100 + MyState->Stats.Armor);
if (MyState->Stats[(uint8)EStats::Armor] >= 0)
ADDamageMultiplier = 100 / (100 + MyState->Stats[(uint8)EStats::Armor]);
else
ADDamageMultiplier = 2 - 100 / (100 - MyState->Stats.Armor);
ADDamageMultiplier = 2 - 100 / (100 - MyState->Stats[(uint8)EStats::Armor]);
if (MyState->Stats.MagicResistance >= 0)
APDamageMultiplier = 100 / (100 + MyState->Stats.MagicResistance);
if (MyState->Stats[(uint8)EStats::MagicResistance] >= 0)
APDamageMultiplier = 100 / (100 + MyState->Stats[(uint8)EStats::MagicResistance]);
else
APDamageMultiplier = 2 - 100 / (100 - MyState->Stats.MagicResistance);
APDamageMultiplier = 2 - 100 / (100 - MyState->Stats[(uint8)EStats::MagicResistance]);
UE_LOG(LogTemp, Warning, TEXT("%s : ADDamageMultiplier : %f CalculatedDamage : %f"), *DamageCauser->GetName(), ADDamageMultiplier, DamageAmount * ADDamageMultiplier);
@@ -122,17 +101,17 @@ float ADefaultPlayerCharacter::TakeDamage_Implementation(float DamageAmount, str
{
UE_LOG(LogTemp, Warning, TEXT("DamageType : BaseAttack"));
float UpdatedHealth = MyState->Stats.Health - EventInstigatorState->Stats.AttackDamage * ADDamageMultiplier;
float UpdatedHealth = MyState->Stats[(uint8)EStats::Health] - EventInstigatorState->Stats[(uint8)EStats::AttackDamage] * ADDamageMultiplier;
if (UpdatedHealth < 0)
{
MyState->Stats.Health = 0;
MyState->Stats[(uint8)EStats::Health] = 0;
}
else
{
MyState->Stats.Health = UpdatedHealth;
MyState->Stats[(uint8)EStats::Health] = UpdatedHealth;
}
UE_LOG(LogTemp, Warning, TEXT("Current Health : %f"), MyState->Stats.Health);
UE_LOG(LogTemp, Warning, TEXT("Current Health : %f"), MyState->Stats[(uint8)EStats::Health]);
}
}

View File

@@ -89,83 +89,11 @@ public:
UFUNCTION(NetMulticast, Reliable)
void NetMulticast_Skill7();
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive")
float Health;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive")
float HPRegeneration;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive")
float HealAndShieldpower;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive")
float Armor;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive")
float MagicResistance;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive")
float Tenacity;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive")
float SlowRisist;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float AttackSpeed;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float AttackDamage;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float AbilityPower;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float CriticalStrikeChance;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float CriticalStrikeDamage;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float ArmorPenetration;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float MagicPenetration;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float LifeSteal;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float PhysicalVamp;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive")
float Omnivamp;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Haste")
float AbilityHaste;
UPROPERTY(EditAnywhere, Category = "Stats|Utility|Haste")
float CooldownDuration[(uint8)CooldownType::SIZE] = { 0.0f, };
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Resource")
float Mana;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Resource")
float ManaRegeneration;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Resource")
float Energy;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Resource")
float EnergyRegeneration;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility")
float AttackRange;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility")
float MovementSpeed;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Non-Combat")
float GoldGeneration;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics")
float AttackDamageGrowth;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics")
float AttackSpeedGrowth;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics")
float ArmorGrowth;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics")
float MagicResistanceGrowth;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics")
float HealthGrowth;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics")
float HealthRegenerationGrowth;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics")
float ManaGrowth;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics")
float ManaRegenerationGrowth;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats")
TMap<FName, float> DefaultStats;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats")
TMap<CooldownType, float> CooldownDuration;
protected:
UPROPERTY(EditAnywhere)
USpringArmComponent* CameraSpringArm;

View File

@@ -18,18 +18,23 @@ void ADefaultPlayerController::BeginPlay()
{
Super::BeginPlay();
if (ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player)) {
if (UEnhancedInputLocalPlayerSubsystem* InputSystem = LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>()) {
if (!PlayerInputMapping.IsNull()) {
InputSystem->AddMappingContext(PlayerInputMapping.LoadSynchronous(), 0);
}
else {
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player);
if (!LocalPlayer) return;
UEnhancedInputLocalPlayerSubsystem* InputSystem = LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>();
if (!InputSystem) return;
ADefaultPlayerCharacter* ControlledPawn = GetPawn<ADefaultPlayerCharacter>();
if (!ControlledPawn) return;
ADefaultPlayerState* MyPlayerState = GetPlayerState<ADefaultPlayerState>();
if (!MyPlayerState) return;
if (PlayerInputMapping.IsNull())
{
UE_LOG(LogTemp, Error, TEXT("AddMappingContext Failed"));
}
}
return;
}
InputSystem->AddMappingContext(PlayerInputMapping.LoadSynchronous(), 0);
this->bShowMouseCursor = true;
//MyPlayerState->InitPlayerStats(ControlledPawn->DefaultStats, ControlledPawn->CooldownDuration);
}
void ADefaultPlayerController::OnPossess(APawn* aPawn)
@@ -39,17 +44,16 @@ void ADefaultPlayerController::OnPossess(APawn* aPawn)
Server_SpawnPlayerCamera();
AActor *PlayerCamera = GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera();
if (PlayerCamera)
if (!PlayerCamera)
{
UE_LOG(LogTemp, Error, TEXT("GetPlayerCamera Failed."));
return;
}
SetViewTarget(PlayerCamera);
UE_LOG(LogTemp, Warning, TEXT("SetViewTarget Success : %s"), *GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera()->GetName());
}
else
{
UE_LOG(LogTemp, Error, TEXT("GetPlayerCamera Failed."));
}
}
void ADefaultPlayerController::OnUnPossess()
{
@@ -66,33 +70,37 @@ void ADefaultPlayerController::Server_SpawnPlayerCamera_Implementation()
UE_LOG(LogTemp, Warning, TEXT("SpawnPlayerCamera"));
if (APawn* MyPawn = GetPawn())
{
APawn* MyPawn = GetPawn();
if (!MyPawn) return;
FTransform SpawnTransform = FTransform();
SpawnTransform.SetLocation(MyPawn->GetActorLocation());
OutContextPlayerCamera = GetWorld()->SpawnActor<AActor>(ADefaultPlayerCamera::StaticClass(), SpawnTransform, SpawnInfo);
if (OutContextPlayerCamera)
if (!OutContextPlayerCamera)
{
UE_LOG(LogTemp, Error, TEXT("Camera Spawn Failed."));
return;
}
GetPlayerState<ADefaultPlayerState>()->SetPlayerCamera(OutContextPlayerCamera);
OutContextPlayerCamera->AttachToActor(GetPawn(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, false));
UE_LOG(LogTemp, Warning, TEXT("SetPlayerCamera Success : %s, %d"), *GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera()->GetName(), GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera());
}
else
{
UE_LOG(LogTemp, Error, TEXT("Camera Spawn Failed."));
}
}
}
void ADefaultPlayerController::SetACharacterOutlineColor(ACharacter* Target, bool Visible)
{
if (!HasAuthority())
{
if (ADefaultPlayerState* State = Target->GetPlayerState<ADefaultPlayerState>())
if (HasAuthority()) return;
ADefaultPlayerState* State = Target->GetPlayerState<ADefaultPlayerState>();
if (!State)
{
UE_LOG(LogTemp, Error, TEXT("GetPlayerState<ADefaultPlayerState> Failed"));
return;
}
if (State->GetTeam() == GetPlayerState<ADefaultPlayerState>()->GetTeam())
{
Target->GetMesh()->SetRenderCustomDepth(Visible);
@@ -104,12 +112,6 @@ void ADefaultPlayerController::SetACharacterOutlineColor(ACharacter* Target, boo
Target->GetMesh()->CustomDepthStencilValue = 2;
}
}
else
{
UE_LOG(LogTemp, Error, TEXT("GetPlayerState<ADefaultPlayerState> Failed"));
}
}
}
ADefaultPlayerController::ADefaultPlayerController()
{
@@ -215,8 +217,9 @@ void ADefaultPlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
if (UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(InputComponent))
{
UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(InputComponent);
if (!EnhancedInputComponent) return;
EnhancedInputComponent->BindAction(Skill1Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Skill1);
EnhancedInputComponent->BindAction(Skill2Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Skill2);
EnhancedInputComponent->BindAction(Skill3Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Skill3);
@@ -229,13 +232,18 @@ void ADefaultPlayerController::SetupInputComponent()
EnhancedInputComponent->BindAction(ObjectSelectAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::ObjectSelect);
EnhancedInputComponent->BindAction(MoveAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Move);
}
}
void ADefaultPlayerController::Skill1()
{
//if (!(GetPlayerState<ADefaultPlayerState>()->Stats.Mana >= 100))
// return;
FVector Location = GetPawn()->GetActorLocation();
Location.Z = 0;
SimpleMoveToLocation(this, Location);
this->MoveToLocation(Location);
Server_SetRotation(GetMouseHitLocation());
UE_LOG(LogTemp, Warning, TEXT("Skill1"));
@@ -245,6 +253,12 @@ void ADefaultPlayerController::Skill1()
void ADefaultPlayerController::Skill2()
{
FVector Location = GetPawn()->GetActorLocation();
Location.Z = 0;
SimpleMoveToLocation(this, Location);
this->MoveToLocation(Location);
Server_SetRotation(GetMouseHitLocation());
UE_LOG(LogTemp, Warning, TEXT("Skill2"));
@@ -254,6 +268,12 @@ void ADefaultPlayerController::Skill2()
void ADefaultPlayerController::Skill3()
{
FVector Location = GetPawn()->GetActorLocation();
Location.Z = 0;
SimpleMoveToLocation(this, Location);
this->MoveToLocation(Location);
Server_SetRotation(GetMouseHitLocation());
UE_LOG(LogTemp, Warning, TEXT("Skill3"));
@@ -263,6 +283,12 @@ void ADefaultPlayerController::Skill3()
void ADefaultPlayerController::Skill4Triggered()
{
FVector Location = GetPawn()->GetActorLocation();
Location.Z = 0;
SimpleMoveToLocation(this, Location);
this->MoveToLocation(Location);
Server_SetRotation(GetMouseHitLocation());
UE_LOG(LogTemp, Warning, TEXT("Skill4 Triggered"));
@@ -272,6 +298,12 @@ void ADefaultPlayerController::Skill4Triggered()
void ADefaultPlayerController::Skill4Completed()
{
FVector Location = GetPawn()->GetActorLocation();
Location.Z = 0;
SimpleMoveToLocation(this, Location);
this->MoveToLocation(Location);
Server_SetRotation(GetMouseHitLocation());
UE_LOG(LogTemp, Warning, TEXT("Skill4 Completed"));
@@ -316,12 +348,12 @@ void ADefaultPlayerController::ObjectSelect()
GetHitResultUnderCursorForObjects(ObjectTypes, true, HitResult);
if (ACharacter* HitObject = Cast<ACharacter>(HitResult.GetActor()))
{
ACharacter* HitObject = Cast<ACharacter>(HitResult.GetActor());
if (!HitObject) return;
UE_LOG(LogTemp, Warning, TEXT("%s"), *HitObject->GetName());
SetACharacterOutlineColor(HitObject, true);
}
}
void ADefaultPlayerController::Move()
{
@@ -337,9 +369,6 @@ void ADefaultPlayerController::Multicast_SetRotation_Implementation(FVector Mous
FVector Location = GetPawn()->GetActorLocation();
Location.Z = 0;
SimpleMoveToLocation(this, Location);
this->MoveToLocation(Location);
GetPawn()->SetActorRotation((MouseHitLocation - Location).Rotation());
}
@@ -367,8 +396,8 @@ FVector ADefaultPlayerController::GetMouseHitLocation()
DrawDebugLine(GetWorld(), HitResult.Location, Destination, FColor::Emerald, false, 1, 0, 1);
const UWorld* CurrentWorld = GetWorld();
if (CurrentWorld)
{
if (!CurrentWorld) return Destination;
FHitResult CollisionCheck;
FCollisionQueryParams CollisionParams;
@@ -377,12 +406,11 @@ FVector ADefaultPlayerController::GetMouseHitLocation()
FVector Start = HitResult.Location;
FVector End = Destination;
if (CurrentWorld->LineTraceSingleByChannel(CollisionCheck, Start, End, ECC_Visibility, CollisionParams))
{
if (!CurrentWorld->LineTraceSingleByChannel(CollisionCheck, Start, End, ECC_Visibility, CollisionParams))
return Destination;
DrawDebugLine(CurrentWorld, Start, End, FColor::Red, false, 1.5, 0, 2);
Destination = HitResult.Location;
}
}
return Destination;
}
@@ -467,8 +495,8 @@ void ADefaultPlayerController::SimpleMoveToLocation(AController* Controller, con
void ADefaultPlayerController::OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult& MovementResult)
{
if (MovementResult.IsSuccess())
{
if (!MovementResult.IsSuccess()) return;
if (!GPlayInEditorID)
{
UE_LOG(LogTemp, Warning, TEXT("Server MoveCompleted"));
@@ -477,9 +505,9 @@ void ADefaultPlayerController::OnMoveCompleted(FAIRequestID RequestID, const FPa
{
UE_LOG(LogTemp, Warning, TEXT("Client%d MoveCompleted"), GPlayInEditorID);
}
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Idle);
}
}
void ADefaultPlayerController::Attack()
{

View File

@@ -26,46 +26,11 @@ void ADefaultPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>&
DOREPLIFETIME(ADefaultPlayerState, PlayerCamera);
}
void ADefaultPlayerState::InitPlayerStats()
void ADefaultPlayerState::InitPlayerStats_Implementation(const TArray<float>& StatsValue, const TArray<float>& CooldownDurationValue)
{
ADefaultPlayerCharacter* Initializer = Cast<ADefaultPlayerCharacter>(CharacterBPRef);
Stats.Health = Initializer->Health;
Stats.HPRegeneration = Initializer->HPRegeneration;
Stats.HealAndShieldpower = Initializer->HealAndShieldpower;
Stats.Armor = Initializer->Armor;
Stats.MagicResistance = Initializer->MagicResistance;
Stats.Tenacity = Initializer->Tenacity;
Stats.SlowRisist = Initializer->SlowRisist;
Stats.AttackSpeed = Initializer->AttackSpeed;
Stats.AttackDamage = Initializer->AttackDamage;
Stats.AbilityPower = Initializer->AbilityPower;
Stats.CriticalStrikeChance = Initializer->CriticalStrikeChance;
Stats.CriticalStrikeDamage = Initializer->CriticalStrikeDamage;
Stats.ArmorPenetration = Initializer->ArmorPenetration;
Stats.MagicPenetration = Initializer->MagicPenetration;
Stats.LifeSteal = Initializer->LifeSteal;
Stats.PhysicalVamp = Initializer->PhysicalVamp;
Stats.Omnivamp = Initializer->Omnivamp;
Stats.AbilityHaste = Initializer->AbilityHaste;
SetMultipleCooldownDuration(Initializer->CooldownDuration);
Stats.Mana = Initializer->Mana;
Stats.ManaRegeneration = Initializer->ManaRegeneration;
Stats.Energy = Initializer->Energy;
Stats.EnergyRegeneration = Initializer->EnergyRegeneration;
Stats.AttackRange = Initializer->AttackRange;
Stats.MovementSpeed = Initializer->MovementSpeed;
Stats.GoldGeneration = Initializer->GoldGeneration;
Stats.AttackDamageGrowth = Initializer->AttackDamageGrowth;
Stats.AttackSpeedGrowth = Initializer->AttackSpeedGrowth;
Stats.ArmorGrowth = Initializer->ArmorGrowth;
Stats.MagicResistanceGrowth = Initializer->MagicResistanceGrowth;
Stats.HealthGrowth = Initializer->HealthGrowth;
Stats.HealthRegenerationGrowth = Initializer->HealthRegenerationGrowth;
Stats.ManaGrowth = Initializer->ManaGrowth;
Stats.ManaRegenerationGrowth = Initializer->ManaRegenerationGrowth;
MaxStats.Append(StatsValue);
Stats.Append(StatsValue);
CooldownDuration.Append(CooldownDurationValue);
}
void ADefaultPlayerState::NetMulticast_SetAttackType_Implementation(CooldownType Value)
@@ -92,8 +57,3 @@ int32 ADefaultPlayerState::GetCharacterLevel() const
{
return int32();
}
void ADefaultPlayerState::SetMultipleCooldownDuration(const float* Value)
{
std::memcpy(&CooldownDuration, Value, sizeof(float) * (uint8)CooldownType::SIZE);
}

View File

@@ -21,7 +21,8 @@ public:
ADefaultPlayerState();
void GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const override;
void InitPlayerStats();
UFUNCTION(Server, Reliable)
void InitPlayerStats(const TArray<float>& StatsValue, const TArray<float>& CooldownDurationValue);
void SetCharacterBPRef(UClass* Value) { CharacterBPRef = Value; }
UClass* GetCharacterBPRef() const { return CharacterBPRef; }
@@ -34,10 +35,11 @@ public:
void SetPlayerCamera(AActor* Actor) { PlayerCamera = Actor; }
AActor* GetPlayerCamera() const { return PlayerCamera; }
UFUNCTION(BlueprintCallable)
void SetCooldownDuration(CooldownType Key, float Value) { CooldownDuration[(uint8)Key] = Value; }
UFUNCTION(BlueprintCallable)
float GetCooldownDuration(CooldownType Key) const { return CooldownDuration[(uint8)Key]; }
//fix later
//UFUNCTION(BlueprintCallable)
//void SetCooldownDuration(CooldownType Key, float Value) { CooldownDuration[(uint8)Key] = Value; }
//UFUNCTION(BlueprintCallable)
//float GetCooldownDuration(CooldownType Key) const { return CooldownDuration[(uint8)Key]; }
//Execute on server
UFUNCTION(BlueprintCallable, Server, Reliable)
@@ -58,13 +60,15 @@ public:
UFUNCTION(BlueprintCallable)
int32 GetCharacterLevel() const;
//Should be ONLY executed on server!!
void SetMultipleCooldownDuration(const float* Value) ;
UPROPERTY(Replicated, Transient, EditAnywhere, BlueprintReadWrite)
TArray<float> Stats;
UPROPERTY(Replicated, Transient, EditAnywhere, BlueprintReadWrite)
TArray<float> MaxStats;
UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite)
FDefaultStats Stats;
UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite)
FDefaultStats MaxStats;
UPROPERTY(Replicated, Transient, BlueprintReadWrite)
TArray<float> CooldownDuration;
UPROPERTY(Replicated, Transient, BlueprintReadWrite)
TArray<float> MaxCooldownDuration;
private:
UPROPERTY(Replicated, Transient)
@@ -72,9 +76,6 @@ private:
UPROPERTY(Replicated, Transient)
TeamType Team;
UPROPERTY(Replicated, Transient)
float CooldownDuration[(uint8)CooldownType::SIZE] = { 0.0f, };
UPROPERTY(Replicated, Transient)
ECharacterState State;
UPROPERTY(Replicated, Transient)

View File

@@ -91,3 +91,41 @@ struct FUniqueObjectID
int32 RandomUniqueNumber;
};
UENUM(BlueprintType)
enum class EStats : uint8
{
Health,
HPRegeneration,
HealAndShieldpower,
Armor,
MagicResistance,
Tenacity,
SlowRisist,
AttackSpeed,
AttackDamage,
AbilityPower,
CriticalStrikeChance,
CriticalStrikeDamage,
ArmorPenetration,
MagicPenetration,
LifeSteal,
PhysicalVamp,
Omnivamp,
AbilityHaste,
Mana,
ManaRegeneration,
Energy,
EnergyRegeneration,
AttackRange,
MovementSpeed,
GoldGeneration,
AttackDamageGrowth,
AttackSpeedGrowth,
ArmorGrowth,
MagicResistanceGrowth,
HealthGrowth,
HealthRegenerationGrowth,
ManaGrowth,
ManaRegenerationGrowth,
SIZE
};