SQCSimulator2023/SQCSim-common/player.h

81 lines
1.8 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-11-13 16:02:13 -05: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-10-30 14:03:10 -04:00
enum Booster { SPEED, HEAL, DAMAGE, INVINCIBLE };
2023-09-30 14:46:54 -04:00
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);
2023-10-30 14:03:10 -04:00
void GetBooster(Booster boosttype);
void RemoveBooster(float elapsedtime);
2023-11-19 16:46:13 -05:00
void ApplyTransformation(Transformation& transformation, bool rel = true, bool rot = true) const;
2023-09-18 15:56:17 -04:00
void SetDirection(Vector3f dir);
2023-12-05 13:44:54 -05:00
void Move(Vector3f diff);
2023-09-18 15:56:17 -04:00
Vector3f GetPosition() const;
2023-12-05 13:44:54 -05:00
Vector3f GetPositionAbs() const;
2023-09-18 15:56:17 -04:00
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-12-13 14:06:22 -05:00
void SetHP(float hp);
2023-09-18 15:56:17 -04:00
void Teleport(int& x, int& z);
2023-12-07 12:32:36 -05:00
bool GetIsAirborne() const;
2023-10-30 14:36:44 -04:00
bool AmIDead();
void InflictDamage(float hitPoints);
2023-12-06 11:16:39 -05:00
int getScore() const;
void addPoint();
uint64_t Killer = 0;
2023-12-06 13:23:33 -05:00
std::string m_username;
2023-12-06 15:47:14 -05:00
bool m_hit = false;
2023-10-23 15:43:55 -04:00
2023-12-13 15:04:08 -05:00
bool Eulogy = false;
2023-09-30 14:46:54 -04:00
private:
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-10-03 12:43:54 -04:00
uint64_t id = 0;
2023-12-06 11:16:39 -05:00
int m_score = 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-10-30 14:03:10 -04:00
float timeboostspeed;
float timeboostdamage;
float timeboostinvincible;
2023-09-18 15:56:17 -04:00
2023-09-30 14:46:54 -04:00
float m_hp;
2023-09-18 15:56:17 -04:00
bool m_airborne;
2023-10-30 14:03:10 -04:00
bool boostspeed;
bool boostdamage;
bool boostinvincible;
2023-10-03 12:43:54 -04:00
2023-11-13 16:02:13 -05:00
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__