shooter/weapon/Shotgun.h

38 lines
1.2 KiB
C
Raw Normal View History

2021-09-13 15:53:43 +03:00
//
// Created by Иван Ильин on 02.06.2021.
//
#ifndef SHOOTER_SHOTGUN_H
#define SHOOTER_SHOTGUN_H
#include "Weapon.h"
#include "../3dzavr/engine/utils/ResourceManager.h"
2021-10-31 19:01:06 +03:00
#include "../ShooterConsts.h"
2021-09-13 15:53:43 +03:00
class Shotgun final : public Weapon {
2021-09-13 15:53:43 +03:00
public:
2022-07-11 16:58:05 +03:00
explicit Shotgun() : Weapon(15, 1, 1.0, 1.0, 50, 5.0, ShooterConsts::SHOTGUN_FIRE_SOUND,
2021-11-06 18:32:55 +03:00
ShooterConsts::SHOTGUN_RELOAD_SOUND, ObjectNameTag("shotgun"),
ShooterConsts::SHOTGUN_OBJ,
Vec3D{3, 3, 3}, Vec3D{-2.1, 0.8, 1.9}, Vec3D{0, 0, 0}) {}
2021-10-31 11:39:08 +03:00
std::map<ObjectNameTag, double>
processFire(std::function<IntersectionInformation(const Vec3D &, const Vec3D &)> rayCastFunction,
2021-11-09 22:54:20 +03:00
const Vec3D &position, const Vec3D &direction) const override {
2021-10-31 19:01:06 +03:00
std::map<ObjectNameTag, double> damagedPlayers;
for (int i = 0; i < 15; i++) {
2021-11-09 22:54:20 +03:00
std::map<ObjectNameTag, double> damaged = fireABullet(rayCastFunction, position, direction);
for (auto &[playerName, damage] : damaged) {
damagedPlayers[playerName] += damage;
2021-10-31 19:01:06 +03:00
}
}
return damagedPlayers;
}
2021-09-13 15:53:43 +03:00
};
#endif //SHOOTER_3DZAVR_SHOTGUN_H