78 lines
1.2 KiB
C++
78 lines
1.2 KiB
C++
/*
|
|
* PlayerController.h
|
|
*
|
|
* Created on: Aug 27, 2021
|
|
* Author: ayoungblood
|
|
*/
|
|
|
|
#ifndef SRC_ECS_PlayerController_H_
|
|
#define SRC_ECS_PlayerController_H_
|
|
|
|
#include "Components.h"
|
|
#include "../game/Vector2D.h"
|
|
|
|
class PlayerController : public Component
|
|
{
|
|
|
|
public:
|
|
|
|
Vector2D lastSafePosition;
|
|
float jumpTime;
|
|
float jumpForce;
|
|
|
|
bool isJumping;
|
|
bool isGrounded;
|
|
|
|
PlayerController()
|
|
{
|
|
jumpTime = 0.0f;
|
|
jumpForce = 0.0f;
|
|
|
|
bool isJumping = false;
|
|
bool isGrounded = false;
|
|
|
|
lastSafePosition = Vector2D();
|
|
}
|
|
|
|
PlayerController(float jumpT, float jumpF, bool jumping, bool grounded, Vector2D lastPos)
|
|
{
|
|
jumpTime = jumpT;
|
|
jumpForce = jumpF;
|
|
|
|
bool isJumping = jumping;
|
|
bool isGrounded = grounded;
|
|
|
|
lastSafePosition = lastPos;
|
|
}
|
|
|
|
~PlayerController()
|
|
{
|
|
|
|
}
|
|
|
|
void init() override
|
|
{
|
|
lastSafePosition.Zero();
|
|
}
|
|
|
|
void update() override
|
|
{
|
|
|
|
}
|
|
|
|
void setLastSafePos(Vector2D prevSafePos)
|
|
{
|
|
lastSafePosition = prevSafePos;
|
|
}
|
|
|
|
// void init() override
|
|
// {
|
|
//
|
|
// }
|
|
|
|
};
|
|
|
|
|
|
#endif /* SRC_ECS_PlayerController_H_ */
|
|
|