changed namespace

This commit is contained in:
devZoGok
2021-11-01 11:49:56 +02:00
parent 54a5edf7c8
commit 14bf591a27
72 changed files with 5236 additions and 5424 deletions
+20 -24
View File
@@ -3,33 +3,29 @@
#include "missile.h"
using namespace game::core;
using namespace game::util;
using namespace vb01;
namespace game{
namespace content{
Missile::Missile(Unit *unit, Node *node, Vector3 *target, Vector3 pos, Vector3 dir, Vector3 left, Vector3 up, int id, int weaponTypeId, int weaponId) :
Projectile(unit, node, pos, dir, left, up, id, weaponTypeId, weaponId) {
this->target = target;
this->type = (MissileType)weaponId;
this->initTime = getTime();
}
void Missile::update() {
Projectile::update();
pos = pos + dirVec * speed;
node->setPosition(pos);
float angle = dirVec.getAngleBetween(*target - pos);
Vector3 axis = dirVec.cross(*target - pos).norm();
namespace battleship{
Missile::Missile(Unit *unit, Node *node, Vector3 *target, Vector3 pos, Vector3 dir, Vector3 left, Vector3 up, int id, int weaponTypeId, int weaponId) :
Projectile(unit, node, pos, dir, left, up, id, weaponTypeId, weaponId) {
this->target = target;
this->type = (MissileType)weaponId;
this->initTime = getTime();
}
void Missile::update() {
Projectile::update();
pos = pos + dirVec * speed;
node->setPosition(pos);
float angle = dirVec.getAngleBetween(*target - pos);
Vector3 axis = dirVec.cross(*target - pos).norm();
if(rotationSpeed / 180 * PI < angle){
Quaternion rotQuat = Quaternion(rotationSpeed / 180 * PI, axis);
orientProjectile(rotQuat * dirVec);
}
if(!exploded && getTime() - initTime > selfDistructTime)
Projectile::explode(nullptr);
if(rotationSpeed / 180 * PI < angle){
Quaternion rotQuat = Quaternion(rotationSpeed / 180 * PI, axis);
orientProjectile(rotQuat * dirVec);
}
if(!exploded && getTime() - initTime > selfDistructTime)
Projectile::explode(nullptr);
}
}