SQCSimulator2023/SQCSim-common/player.h

46 lines
1000 B
C
Raw Normal View History

2023-09-30 14:54:39 -04:00
#ifndef PLAYER_H__
#define PLAYER_H__
2023-09-18 15:56:17 -04:00
#include <cmath>
2023-09-30 14:46:54 -04:00
#include "transformation.h"
#include "vector3.h"
2023-09-18 15:56:17 -04:00
2023-09-30 14:46:54 -04:00
class World;
2023-09-18 15:56:17 -04:00
class Player {
public:
2023-09-30 14:46:54 -04:00
enum Sound { NOSOUND, STEP, FALL };
2023-09-18 15:56:17 -04:00
Player(const Vector3f& position, float rotX = 0, float rotY = 0);
void TurnLeftRight(float value);
void TurnTopBottom(float value);
Vector3f GetInput(bool front, bool back, bool left, bool right, bool jump, bool dash, float elapsedTime);
2023-09-30 14:46:54 -04:00
Sound ApplyPhysics(Vector3f input, World* world, float elapsedTime);
void ApplyTransformation(Transformation& transformation, bool rel = true) const;
2023-09-18 15:56:17 -04:00
Vector3f GetPosition() const;
Vector3f GetDirection() const;
Vector3f GetVelocity() const;
Vector3f GetPOV() const;
2023-09-30 14:46:54 -04:00
std::string GetUsername() const;
float GetHP() const;
2023-09-18 15:56:17 -04:00
void Teleport(int& x, int& z);
2023-09-30 14:46:54 -04:00
private:
2023-09-18 15:56:17 -04:00
Vector3f m_position;
Vector3f m_velocity;
Vector3f m_direction;
2023-09-30 14:46:54 -04:00
std::string m_username;
2023-09-18 15:56:17 -04:00
float m_rotX = 0;
float m_rotY = 0;
float m_POV;
2023-09-30 14:46:54 -04:00
float m_hp;
2023-09-18 15:56:17 -04:00
bool m_airborne;
};
#endif //_PLAYER_H__