스탯이 이제 stats와 동기화됩니다.
This commit is contained in:
BIN
Content/Character/BP_Folder/DefaultClass.uasset
(Stored with Git LFS)
BIN
Content/Character/BP_Folder/DefaultClass.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Character/Lb/BP_Lb.uasset
(Stored with Git LFS)
BIN
Content/Character/Lb/BP_Lb.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Maps/DevMap.umap
(Stored with Git LFS)
BIN
Content/Maps/DevMap.umap
(Stored with Git LFS)
Binary file not shown.
@@ -24,16 +24,9 @@ ADefaultPlayerCharacter::ADefaultPlayerCharacter()
|
|||||||
|
|
||||||
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
|
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
|
||||||
Camera->SetupAttachment(CameraSpringArm, USpringArmComponent::SocketName);
|
Camera->SetupAttachment(CameraSpringArm, USpringArmComponent::SocketName);
|
||||||
|
|
||||||
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++)
|
for (uint8 i = 0; i < (uint8)EStats::SIZE; i++)
|
||||||
DefaultStats.Add(*CharStateEnum->GetNameByValue((uint8)i).ToString(), 0.0f);
|
DefaultStats.Add((EStats)i, 0.0f);
|
||||||
|
|
||||||
for (uint8 i = 0; i < (uint8)CooldownType::SIZE; i++)
|
for (uint8 i = 0; i < (uint8)CooldownType::SIZE; i++)
|
||||||
CooldownDuration.Add((CooldownType)i, 0.0f);
|
CooldownDuration.Add((CooldownType)i, 0.0f);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
void NetMulticast_Skill7();
|
void NetMulticast_Skill7();
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats")
|
||||||
TMap<FName, float> DefaultStats;
|
TMap<EStats, float> DefaultStats;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats")
|
||||||
TMap<CooldownType, float> CooldownDuration;
|
TMap<CooldownType, float> CooldownDuration;
|
||||||
|
|||||||
@@ -20,12 +20,10 @@ void ADefaultPlayerController::BeginPlay()
|
|||||||
|
|
||||||
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player);
|
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player);
|
||||||
if (!LocalPlayer) return;
|
if (!LocalPlayer) return;
|
||||||
|
|
||||||
UEnhancedInputLocalPlayerSubsystem* InputSystem = LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>();
|
UEnhancedInputLocalPlayerSubsystem* InputSystem = LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>();
|
||||||
if (!InputSystem) return;
|
if (!InputSystem) return;
|
||||||
ADefaultPlayerCharacter* ControlledPawn = GetPawn<ADefaultPlayerCharacter>();
|
|
||||||
if (!ControlledPawn) return;
|
|
||||||
ADefaultPlayerState* MyPlayerState = GetPlayerState<ADefaultPlayerState>();
|
|
||||||
if (!MyPlayerState) return;
|
|
||||||
if (PlayerInputMapping.IsNull())
|
if (PlayerInputMapping.IsNull())
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Error, TEXT("AddMappingContext Failed"));
|
UE_LOG(LogTemp, Error, TEXT("AddMappingContext Failed"));
|
||||||
@@ -34,7 +32,6 @@ void ADefaultPlayerController::BeginPlay()
|
|||||||
|
|
||||||
InputSystem->AddMappingContext(PlayerInputMapping.LoadSynchronous(), 0);
|
InputSystem->AddMappingContext(PlayerInputMapping.LoadSynchronous(), 0);
|
||||||
this->bShowMouseCursor = true;
|
this->bShowMouseCursor = true;
|
||||||
//MyPlayerState->InitPlayerStats(ControlledPawn->DefaultStats, ControlledPawn->CooldownDuration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADefaultPlayerController::OnPossess(APawn* aPawn)
|
void ADefaultPlayerController::OnPossess(APawn* aPawn)
|
||||||
@@ -53,6 +50,20 @@ void ADefaultPlayerController::OnPossess(APawn* aPawn)
|
|||||||
SetViewTarget(PlayerCamera);
|
SetViewTarget(PlayerCamera);
|
||||||
|
|
||||||
UE_LOG(LogTemp, Warning, TEXT("SetViewTarget Success : %s"), *GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera()->GetName());
|
UE_LOG(LogTemp, Warning, TEXT("SetViewTarget Success : %s"), *GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera()->GetName());
|
||||||
|
|
||||||
|
ADefaultPlayerCharacter* ControlledPawn = GetPawn<ADefaultPlayerCharacter>();
|
||||||
|
if (!ControlledPawn) return;
|
||||||
|
|
||||||
|
ADefaultPlayerState* MyPlayerState = GetPlayerState<ADefaultPlayerState>();
|
||||||
|
if (!MyPlayerState) return;
|
||||||
|
|
||||||
|
TArray<float> DefaultStatsValue;
|
||||||
|
TArray<float> CooldownDurationValue;
|
||||||
|
|
||||||
|
ControlledPawn->DefaultStats.GenerateValueArray(DefaultStatsValue);
|
||||||
|
ControlledPawn->CooldownDuration.GenerateValueArray(CooldownDurationValue);
|
||||||
|
|
||||||
|
MyPlayerState->InitPlayerStats(DefaultStatsValue, CooldownDurationValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADefaultPlayerController::OnUnPossess()
|
void ADefaultPlayerController::OnUnPossess()
|
||||||
|
|||||||
@@ -31,6 +31,13 @@ void ADefaultPlayerState::InitPlayerStats_Implementation(const TArray<float>& St
|
|||||||
MaxStats.Append(StatsValue);
|
MaxStats.Append(StatsValue);
|
||||||
Stats.Append(StatsValue);
|
Stats.Append(StatsValue);
|
||||||
CooldownDuration.Append(CooldownDurationValue);
|
CooldownDuration.Append(CooldownDurationValue);
|
||||||
|
MaxCooldownDuration.Append(CooldownDurationValue);
|
||||||
|
|
||||||
|
|
||||||
|
for (float Value : StatsValue)
|
||||||
|
{
|
||||||
|
UE_LOG(LogTemp, Warning, TEXT("Values: %f"), Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADefaultPlayerState::NetMulticast_SetAttackType_Implementation(CooldownType Value)
|
void ADefaultPlayerState::NetMulticast_SetAttackType_Implementation(CooldownType Value)
|
||||||
|
|||||||
Reference in New Issue
Block a user