Cleanup de l'objet Bullet

This commit is contained in:
MarcEricMartel
2023-09-29 17:02:57 -04:00
parent 954b976f27
commit 6bea176979
9 changed files with 23 additions and 84 deletions

View File

@@ -1,10 +1,9 @@
#include "bullet.h"
#include "world.h"
Bullet::Bullet(Player& player) {
m_startpos = m_currentpos = player.GetPOV() + player.GetDirection();
m_velocity = player.GetDirection();
}
Bullet::Bullet(Vector3f pos, Vector3f dir) : m_startpos(pos), m_currentpos(pos), m_velocity(dir) {}
Bullet::Bullet(Vector3f pos, Vector3f dir, uint64_t tid): m_startpos(pos), m_currentpos(pos), m_velocity(dir), m_tid(tid) {}
Bullet::~Bullet() {}
@@ -31,6 +30,10 @@ void Bullet::Transpose(int& x, int& z) {
m_startpos.z -= z * CHUNK_SIZE_Z;
}
Vector3f& Bullet::getPos() {
Vector3f Bullet::getPos() {
return m_currentpos;
}
uint64_t Bullet::getTeamID(){
return m_tid;
}

View File

@@ -1,23 +1,26 @@
#ifndef BULLET_H__
#define BULLET_H__
#include "player.h"
#include "define.h"
#include "vector3.h"
class World;
class Bullet {
public:
Bullet(Player& player);
Bullet(Vector3f pos, Vector3f dir);
Bullet(Vector3f pos, Vector3f dir, uint64_t tid);
~Bullet();
bool Update(World* world, float elapsedtime);
void Transpose(int& x, int& z);
Vector3f& getPos();
Vector3f getPos();
uint64_t getTeamID();
private:
Vector3f m_startpos;
Vector3f m_currentpos;
Vector3f m_velocity;
Vector3f m_startpos,
m_currentpos,
m_velocity;
uint64_t m_tid = 0;
};
#endif // BULLET_H__