-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmitter.h
More file actions
75 lines (53 loc) · 1.15 KB
/
Copy pathEmitter.h
File metadata and controls
75 lines (53 loc) · 1.15 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
#include "Headers.h"
#include "Sprite.h"
#include "Input.h"
extern Input gInput;
class Particle {
public:
Particle ();
void Update (float t);
void SetPos (XMFLOAT3 p);
void SetSpeed (float spd);
void SetAngle (float ang);
void SetAlive (bool alive);
void SetAcc (XMFLOAT3 acceleration);
XMFLOAT3 GetPos();
bool GetAlive();
void MovePos (XMFLOAT3 v);
private:
bool m_alive;
float m_lifeTime;
XMFLOAT3 m_pos;
XMFLOAT3 m_vel; //(spd, angle)
XMFLOAT3 m_acc; //(spd, angle)
bool hit = 0;
};
class Emitter {
public:
Emitter();
void SetFollowPos(XMFLOAT3* p);
void SetFollowAngle(float* a);
void Create();
void Reset();
void Update(double deltaTime);
void Draw();
void Fire();
XMFLOAT4 GetCollision(int i);
void MoveBy(int i, XMFLOAT3 v);
void ParticleMoveBy(XMFLOAT3 pos, int index);
Particle *m_particles;
int m_numParticles;
private:
int m_partCounter = 0;
Sprite m_sprite;
XMFLOAT3 m_pos;
XMFLOAT3 m_vel;
float m_timeSinceLastFrame = 0.0f;
float m_hold = 80.0f;
bool m_canFire = true;
XMFLOAT3* m_followPos;
float* m_followAngle;
bool m_useFollowPos = 0;
bool m_useFollowAngle = 0;
};