void CBulletInfo::Init(const Vector3 position, const Vector3 direction, const float speed, const float lifetime) { SetPosition(position); SetDirection(direction); SetSpeed(speed); SetLifetime(lifetime); SetStatus(true); }
void Shuriken::Update() { double deltaTime = GLOBAL::GetInstance().GetDeltaTime(); // Update position m_position.x += (float)(m_direction.x*m_speed*deltaTime); m_position.y += (float)(m_direction.y*m_speed*deltaTime); m_position.z += (float)(m_direction.z*m_speed*deltaTime); m_rotation.y += (float)(SHURIKEN_ROTATION_SPEED*deltaTime); // Update lifetime SetLifetime((float)(GetLifetime() - deltaTime)); }
bool Shuriken::Initialize(const char* p_filepath, DirectX::XMFLOAT3 p_pos, DirectX::XMFLOAT3 p_dir, unsigned int p_shurikenID) { if (MovingObject::Initialize(p_filepath, p_pos, p_dir, SHURIKEN_SPEED)) { SetLifetime(SHURIKEN_DURATION); } else { return false; } m_shurikenID = p_shurikenID; return true; }
void CBulletInfo::Update(const double dt) { // check if the bullet is active if(getStatus() == true) { // Update the position of the bullet SetPosition(getPosition() + getDirection() * getSpeed() * static_cast<float>(dt)); // Update the lifetime SetLifetime(getLifetime() - static_cast<float>(dt)); // check if the lifetime is gone if(getLifetime() < 0) { SetStatus( false); } } }
void CEntityFlame::SupplementDamage(float dmg) { SetLifetime((m_flLifetime - gpGlobals->curtime) + max(dmg/5.0f*15.0f, 1.0f)); }
MineActor::MineActor(dtGame::GameActorProxy& proxy) : ProjectileActor(proxy) { SetLifetime(MINE_LIFETIME); SetArmingDelay(MINE_ARMING_DELAY); }