// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.

#pragma once

#include "CoreMinimal.h"
#include "Data/OLSLocomotionData.h"
#include "GameFramework/Character.h"
#include "Interfaces/OLSAnimationInterface.h"
#include "Interfaces/OLSMoveableInterface.h"
#include "Interfaces/OLSReplicatedMovableInterface.h"
#include "OLSCharacter.generated.h"

UCLASS()
class OLS_API AOLSCharacter : public ACharacter,
							  public IOLSMoveableInterface,
							  public IOLSAnimationInterface
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	AOLSCharacter(const FObjectInitializer& objectInitializer);

protected:
	
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

	virtual void InitializeSystems();

public:
	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* playerInputComponent) override;

public:

	//~ IOLSMoveableInterface BEGIN
	virtual class UPawnMovementComponent* GetMovementComponent() const override;
	virtual class UOLSLocomotionComponent* GetLocomotionComponent() const override;
	virtual float GetMaxAcceleration() const override;
	virtual FVector GetCurrentAcceleration() const override;
	virtual EMovementMode GetMovementMode() const override;

	virtual void SetMaxWalkSpeed(const float newMaxWalkSpeed) override;
	virtual bool IsOrientRotationToMovement() const override;
	//~ IOLSMoveableInterface END

	//~ IOLSAnimationInterface BEGIN
	virtual class UAnimInstance* GetAnimInstance() const override;
	//~ IOLSAnimationInterface END

protected:

	virtual void OnRotationModeChanged(const EOLSRotationMode& prevrRotationMode);
	
protected:

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Components)
	TObjectPtr<class UOLSLocomotionComponent> LocomotionComponent = nullptr;
};
