feat: initial commit, only bugs remaining
This commit is contained in:
		| @@ -10,6 +10,9 @@ | ||||
| #include "GameFramework/SpringArmComponent.h" | ||||
| #include "Materials/Material.h" | ||||
| #include "Engine/World.h" | ||||
| #include "SkillTree/SkillTreeComponent.h" | ||||
| #include "SkillTree/SkillTreeSubsystem.h" | ||||
| #include "SkillTree/CharacterStatsComponent.h" | ||||
|  | ||||
| AUTAD_UICharacter::AUTAD_UICharacter() | ||||
| { | ||||
| @@ -50,9 +53,46 @@ AUTAD_UICharacter::AUTAD_UICharacter() | ||||
| 	// Activate ticking in order to update the cursor every frame. | ||||
| 	PrimaryActorTick.bCanEverTick		   = true; | ||||
| 	PrimaryActorTick.bStartWithTickEnabled = true; | ||||
|  | ||||
| 	// Create the skill tree component | ||||
| 	SkillTreeComponent = CreateDefaultSubobject<USkillTreeComponent>(TEXT("SkillTreeComponent")); | ||||
|  | ||||
| 	// Create the character stats component | ||||
| 	CharacterStatsComponent = CreateDefaultSubobject<UCharacterStatsComponent>(TEXT("CharacterStatsComponent")); | ||||
|  | ||||
| 	// Initialize character level | ||||
| 	CharacterLevel = 1; | ||||
| } | ||||
|  | ||||
| void AUTAD_UICharacter::BeginPlay() | ||||
| { | ||||
| 	Super::BeginPlay(); | ||||
|  | ||||
| 	// Register the skill tree component with the manager | ||||
| 	if (SkillTreeComponent) | ||||
| 	{ | ||||
| 		if (USkillTreeSubsystem* Manager = USkillTreeSubsystem::GetSkillTreeManager(this)) | ||||
| 		{ | ||||
| 			Manager->RegisterPlayerSkillTree(SkillTreeComponent); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void AUTAD_UICharacter::Tick(float DeltaSeconds) | ||||
| { | ||||
| 	Super::Tick(DeltaSeconds); | ||||
| } | ||||
|  | ||||
| void AUTAD_UICharacter::LevelUp() | ||||
| { | ||||
| 	CharacterLevel++; | ||||
|  | ||||
| 	// Grant skill points on level up | ||||
| 	if (SkillTreeComponent) | ||||
| 	{ | ||||
| 		// Grant 1 skill point per level (can be configured) | ||||
| 		SkillTreeComponent->AddSkillPoints(1); | ||||
|  | ||||
| 		UE_LOG(LogTemp, Log, TEXT("Character leveled up to %d! Gained 1 skill point."), CharacterLevel); | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user