factored out a state manager

using GameManager via a singleton
This commit is contained in:
devZoGok
2021-10-30 08:09:30 +03:00
parent 7f8824cb29
commit 179f4c28ac
70 changed files with 654 additions and 474 deletions
+4 -2
View File
@@ -7,8 +7,8 @@ using namespace irr::scene;
namespace game{
namespace content{
Missile::Missile(GameManager *gM, Unit *unit, ISceneNode *node, vector3df *target,vector3df pos,vector3df dir, vector3df left, vector3df up,int id,int weaponTypeId,int weaponId) :
Projectile(gM, unit, node, pos, dir, left, up,id,weaponTypeId,weaponId) {
Missile::Missile(Unit *unit, ISceneNode *node, vector3df *target,vector3df pos,vector3df dir, vector3df left, vector3df 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();
@@ -20,10 +20,12 @@ namespace game{
node->setPosition(pos);
float angle=getAngleBetween(dirVec,*target-pos);
vector3df axis=dirVec.crossProduct(*target-pos).normalize();
if(rotationSpeed/180*PI<angle){
quaternion rotQuat=quaternion().fromAngleAxis(rotationSpeed/180*PI,axis);
orientProjectile(rotQuat*dirVec);
}
if(!exploded&&getTime()-initTime>selfDistructTime)
Projectile::explode(nullptr);
}