2021-09-13 15:53:43 +03:00
|
|
|
//
|
|
|
|
// Created by Иван Ильин on 02.06.2021.
|
|
|
|
//
|
|
|
|
|
2021-10-09 13:41:12 +03:00
|
|
|
#include "../engine/ResourceManager.h"
|
2021-09-13 15:53:43 +03:00
|
|
|
#include "Shotgun.h"
|
2021-10-09 13:41:12 +03:00
|
|
|
#include "../engine/animation/AFunction.h"
|
2021-10-16 20:22:55 +03:00
|
|
|
#include "../ShooterConsts.h"
|
2021-09-13 15:53:43 +03:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2021-10-29 18:19:30 +03:00
|
|
|
Shotgun::Shotgun() : Weapon(15, 1, 1.0, 1.0, 400, 5.0, ShooterConsts::SHOTGUN_FIRE_SOUND, ShooterConsts::SHOTGUN_RELOAD_SOUND, ObjectNameTag("shotgun"), ShooterConsts::SHOTGUN_OBJ, Vec3D{3, 3, 3}, Vec3D{-1.95, 0.8, 1.5}, Vec3D{0, Consts::PI, 0}) {
|
2021-09-13 15:53:43 +03:00
|
|
|
}
|
|
|
|
|
2021-10-17 10:21:10 +03:00
|
|
|
std::map<ObjectNameTag, double>
|
2021-10-22 19:42:32 +03:00
|
|
|
Shotgun::processFire(std::function<IntersectionInformation(const Vec3D&, const Vec3D&)> rayCastFunction, const Vec3D& position, const Vec3D& direction) {
|
2021-10-17 10:21:10 +03:00
|
|
|
std::map<ObjectNameTag, double> damagedPlayers;
|
2021-09-13 15:53:43 +03:00
|
|
|
|
|
|
|
for(int i = 0; i < 15; i++) {
|
2021-10-18 18:30:02 +03:00
|
|
|
std::map<ObjectNameTag, double> damaged = addTrace(rayCastFunction, position, direction);
|
2021-10-28 16:58:02 +03:00
|
|
|
for(auto& player : damaged) {
|
2021-10-16 20:22:55 +03:00
|
|
|
damagedPlayers[player.first] += player.second;
|
2021-10-28 16:58:02 +03:00
|
|
|
}
|
2021-09-13 15:53:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return damagedPlayers;
|
|
|
|
}
|