-
Notifications
You must be signed in to change notification settings - Fork 2
/
BossChargeEffect.cpp
113 lines (95 loc) · 2.5 KB
/
BossChargeEffect.cpp
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//=====================================
//
//ボスチャージパーティクル処理[BossChargeParticle.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "BossChargeEffect.h"
/**************************************
マクロ定義
***************************************/
/**************************************
BossChargeParticleコンストラクタ
***************************************/
BossChargeParticle::BossChargeParticle()
{
SetAnimParameter(&D3DXVECTOR2(8.0f, 8.0f));
}
/**************************************
BossChargeParticle初期化
***************************************/
void BossChargeParticle::Init()
{
cntFrame = 0;
active = true;
transform.Rotate(0.0f, 0.0f, RandomRangef(0.0f, 360.0f));
const float PosRange = 5.0f * transform.scale.x;
transform.pos.x += RandomRangef(-PosRange, PosRange);
transform.pos.y += RandomRangef(-PosRange, PosRange);
lifeFrame = 60;
}
/**************************************
BossChargeParticle更新処理
***************************************/
void BossChargeParticle::Update()
{
cntFrame++;
float t = (float)cntFrame / lifeFrame;
Animation(t);
if (cntFrame == lifeFrame)
{
active = false;
}
}
/**************************************
BossChargeEmitter初期化
***************************************/
void BossChargeEmitter::Init()
{
cntFrame = 0;
active = true;
transform.scale = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
duration = 90;
}
/**************************************
BossChargeEmitter更新処理
***************************************/
void BossChargeEmitter::Update()
{
cntFrame++;
const float DeltaScale = 0.02f;
transform.scale += D3DXVECTOR3(1.0f, 1.0f, 1.0f) * DeltaScale;
if (cntFrame == duration)
{
active = false;
}
}
/**************************************
BossChargeParticleController初期化
***************************************/
void BossChargeParticleController::Init()
{
MakeUnitBuffer(&D3DXVECTOR2(30.0f, 30.0f), &D3DXVECTOR2(8.0f, 8.0f));
LoadTexture("data/TEXTURE/EFFECT/EnemyBulletCharge.png");
particleContainer.resize(1023);
for (auto&& particle : particleContainer)
{
particle = new BossChargeParticle();
}
emitterContainer.resize(4);
for (auto&& emitter : emitterContainer)
{
emitter = new BossChargeEmitter();
}
}
/**************************************
BossChargeParticlrController放出処理
***************************************/
void BossChargeParticleController::Emit()
{
ForEachEmitter(5, [](BaseEmitter* emitter, BaseParticle* particle)
{
particle->transform = emitter->transform;
particle->Init();
});
}