SQCSimulator2023/SQCSim-common/player.h

54 lines
1.2 KiB
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);
2023-10-03 12:43:54 -04:00
~Player();
2023-09-18 15:56:17 -04:00
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-10-27 14:08:06 -04:00
uint64_t getId() const;
2023-10-03 12:43:54 -04:00
protected:
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-10-03 12:43:54 -04:00
uint64_t id = 0;
2023-09-30 14:46:54 -04:00
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;
2023-10-03 12:43:54 -04:00
Vector3f InterpolatePosition(const Vector3f& vec1, const Vector3f& vec2, const Timestamp& tim1, const Timestamp& tim2, const Timestamp& now);
2023-09-18 15:56:17 -04:00
};
#endif //_PLAYER_H__