I have a class called ATimer. It has a timer and when the timer ends it calls its own function CountdownHasFinished(). That function has to call a function from the class APlayer. That function is called StartMoving(). How do I do that in c++ or is there another way to do basically the same?
ATimer.h (simplified)
#pragma once
#include "GameFramework/Actor.h"
#include "Timer.generated.h"
UCLASS()
class QUICKSTART_API ATimer: public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ATimer();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
void CountdownHasFinished();
FTimerHandle CountdownTimerHandle;
};
APlayer.h (simplified)
#pragma once
#include "GameFramework/Pawn.h"
#include "Player.generated.h"
UCLASS()
class QUICKSTART_API APlayer: public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
APlayer();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick(float DeltaSeconds) override;
void StartMoving();
};