stone_projectile.cpp 1020 B

1234567891011121314151617181920212223242526272829
  1. #include "stone_projectile.h"
  2. namespace Game::Systems {
  3. StoneProjectile::StoneProjectile(const QVector3D &start, const QVector3D &end,
  4. const QVector3D &color, float speed,
  5. float arc_height, float inv_dist, float scale,
  6. bool should_apply_damage, int damage,
  7. Engine::Core::EntityID attacker_id,
  8. Engine::Core::EntityID target_id)
  9. : m_start(start), m_end(end), m_color(color), m_speed(speed),
  10. m_arc_height(arc_height), m_inv_dist(inv_dist), m_scale(scale),
  11. m_should_apply_damage(should_apply_damage), m_damage(damage),
  12. m_target_id(target_id), m_attacker_id(attacker_id),
  13. m_target_locked_position(end) {}
  14. void StoneProjectile::update(float delta_time) {
  15. if (!m_active) {
  16. return;
  17. }
  18. m_t += delta_time * m_speed * m_inv_dist;
  19. if (m_t >= 1.0F) {
  20. m_t = 1.0F;
  21. m_active = false;
  22. }
  23. }
  24. } // namespace Game::Systems