merge conflict
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#define TEXTURE_SIZE 512
|
||||
#define MAX_BULLETS 512
|
||||
|
||||
#define NB_BOOST 1
|
||||
#define TIME_SPEED_BOOST 10 //secondes
|
||||
#define TIME_DAMAGE_BOOST 10 //secondes
|
||||
#define TIME_INVINCIBLE_BOOST 4 //secondes
|
||||
|
||||
@@ -68,8 +68,8 @@ Vector3f Player::GetInput(bool front, bool back, bool left, bool right, bool jum
|
||||
delta.x *= .6f;
|
||||
delta.z *= .6f;
|
||||
|
||||
if ((jump || shoot ) && !m_airborne) {
|
||||
delta.y += jump? .32f: shoot? .1f : 0.f;
|
||||
if ((jump || shoot) && !m_airborne) {
|
||||
delta.y += jump ? .32f : shoot ? .1f : 0.f;
|
||||
m_airborne = true;
|
||||
}
|
||||
if (boostspeed)
|
||||
@@ -84,7 +84,7 @@ Vector3f Player::GetInput(bool front, bool back, bool left, bool right, bool jum
|
||||
return delta;
|
||||
}
|
||||
|
||||
Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTime) {
|
||||
Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTime, Booster booster_table[]) {
|
||||
Player::Sound snd = Player::Sound::NOSOUND;
|
||||
static float timing = 0.f;
|
||||
/* Gestion de collisions */
|
||||
@@ -198,37 +198,49 @@ Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTi
|
||||
else isStep = false;
|
||||
m_POV = m_position.y;
|
||||
m_POV += m_airborne ? 0 : (sin(bobbingtime) - 0.5f) * (abs(m_velocity.x) + abs(m_velocity.z)) * .2f;
|
||||
TakeBooster(booster_table);
|
||||
RemoveBooster(elapsedTime);
|
||||
return snd;
|
||||
}
|
||||
|
||||
void Player::ApplyTransformation(Transformation& transformation, bool rel, bool rot) const {
|
||||
|
||||
transformation.ApplyRotation(-m_rotX, 1, 0, 0);
|
||||
transformation.ApplyRotation(-m_rotY, 0, 1, 0);
|
||||
|
||||
|
||||
if (rel) transformation.ApplyTranslation(-GetPOV());
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Player::GetBooster(Booster boosttype)
|
||||
void Player::TakeBooster(Booster booster_table[])
|
||||
{
|
||||
if (boosttype == SPEED)
|
||||
for (int i = 0; i < sizeof(booster_table); i++)
|
||||
{
|
||||
if (abs((m_position.x + m_position.y + m_position.z) - (booster_table[i].GetPosition().x + booster_table[i].GetPosition().y + booster_table[i].GetPosition().z)) <= 0.5f && booster_table[i].GetAvailability() == true)
|
||||
{
|
||||
GetBooster(booster_table[i].GetType());
|
||||
booster_table[i].SetAvailability(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::GetBooster(BOOST_TYPE boosttype)
|
||||
{
|
||||
if (boosttype == BTYPE_SPEED)
|
||||
{
|
||||
boostspeed = true;
|
||||
timeboostspeed = 0;
|
||||
}
|
||||
if (boosttype == HEAL)
|
||||
if (boosttype == BTYPE_HEAL)
|
||||
{
|
||||
m_hp = 100;
|
||||
}
|
||||
if (boosttype == DAMAGE)
|
||||
if (boosttype == BTYPE_DAMAGE)
|
||||
{
|
||||
boostdamage = true;
|
||||
timeboostdamage = 0;
|
||||
}
|
||||
if (boosttype == INVINCIBLE)
|
||||
if (boosttype == BTYPE_INVINCIBLE)
|
||||
{
|
||||
boostinvincible = true;
|
||||
boostinvincible = 0;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <cmath>
|
||||
#include "transformation.h"
|
||||
#include "vector3.h"
|
||||
#include "../SQCSim2021/booster.h"
|
||||
#include "define.h"
|
||||
|
||||
|
||||
class World;
|
||||
@@ -11,7 +13,7 @@ class World;
|
||||
class Player {
|
||||
public:
|
||||
enum Sound { NOSOUND, STEP, FALL };
|
||||
enum Booster { SPEED, HEAL, DAMAGE, INVINCIBLE };
|
||||
//enum BoosterType { SPEED, HEAL, DAMAGE, INVINCIBLE };
|
||||
|
||||
Player(const Vector3f& position, float rotX = 0, float rotY = 0);
|
||||
~Player();
|
||||
@@ -19,8 +21,9 @@ public:
|
||||
void TurnLeftRight(float value, float sensitivity);
|
||||
void TurnTopBottom(float value, float sensitivity);
|
||||
Vector3f GetInput(bool front, bool back, bool left, bool right, bool jump, bool dash, float elapsedTime);
|
||||
Sound ApplyPhysics(Vector3f input, World* world, float elapsedTime);
|
||||
void GetBooster(Booster boosttype);
|
||||
Sound ApplyPhysics(Vector3f input, World* world, float elapsedTime, Booster booster_table[]);
|
||||
void TakeBooster(Booster booster_table[]);
|
||||
void GetBooster(BOOST_TYPE boosttype);
|
||||
void RemoveBooster(float elapsedtime);
|
||||
void ApplyTransformation(Transformation& transformation, bool rel = true, bool rot = true) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user