2dkg/2dkg_zad5/2dgk_zad5/KPlayerController.h
2022-01-20 08:52:14 +01:00

37 lines
783 B
C++

#pragma once
#include "KPawn.h"
#include "KPlayer.h"
#include "KVector2d.h"
namespace KapitanGame {
class KInput;
class KPlayerController : public std::enable_shared_from_this<KPlayerController>
{
public:
explicit KPlayerController(const KPlayer player)
: Player(player)
{
}
void SetupInputBindings(KInput& input);
void MoveXAxis(float axis);
void StartJump();
void StopJump();
void Update(float deltaTime);
void Possess(KPawn* pawn);
void UnPossess();
const KPlayer& GetPlayer() const;
private:
KVector2D Input{ 0.f, 0.f };
const KPlayer Player;
KPawn* Pawn{};
bool InputStartJump{};
bool InputStopJump{};
};
typedef void (KPlayerController::* KPlayerCommand)();
typedef void (KPlayerController::* KPlayerAxisCommand)(float input);
}