arrow_projectile.cpp 721 B

12345678910111213141516171819202122232425
  1. #include "arrow_projectile.h"
  2. namespace Game::Systems {
  3. ArrowProjectile::ArrowProjectile(const QVector3D &start, const QVector3D &end,
  4. const QVector3D &color, float speed,
  5. float arc_height, float inv_dist,
  6. bool is_ballista_bolt)
  7. : m_start(start), m_end(end), m_color(color), m_speed(speed),
  8. m_arc_height(arc_height), m_inv_dist(inv_dist),
  9. m_is_ballista_bolt(is_ballista_bolt) {}
  10. void ArrowProjectile::update(float delta_time) {
  11. if (!m_active) {
  12. return;
  13. }
  14. m_t += delta_time * m_speed * m_inv_dist;
  15. if (m_t >= 1.0F) {
  16. m_t = 1.0F;
  17. m_active = false;
  18. }
  19. }
  20. } // namespace Game::Systems