-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gun.h
50 lines (37 loc) · 952 Bytes
/
Gun.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include <string>
#include <glm\glm.hpp>
#include <vector>
#include <NeroEngine\AudioEngine.h>
#include "Bullet.h"
class Gun
{
public:
Gun(std::string name,
int fireRate,
int bulletPerShot,
float spread,
float bulletDamage,
float bulletSpeed,
NeroEngine::SoundEffect fireEffect);
~Gun();
std::string getName() const{ return _name; }
float getRate() const{ return _bulletPerShot; }
float getDamage() const{ return _buletDamage; }
float getSpread() const{ return _spread; }
void update(bool isMouseDown,
const glm::vec2& position,
const glm::vec2& direction,
std::vector<Bullet>& bulltes,
float deltaTime);
private:
void fire(const glm::vec2& direction, const glm::vec2& position, std::vector<Bullet>& bulltes);
std::string _name;
NeroEngine::SoundEffect _fireEffect;
int _fireRate;//
int _bulletPerShot;
float _spread;
float _bulletSpeed;
float _buletDamage;
float _frameCounter;
};