forked from YutaTachibana0310/SankouGoudou2019Summer
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BossHitParticle.cpp
116 lines (99 loc) · 2.66 KB
/
BossHitParticle.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
114
115
116
//=====================================
//
//ボスヒットパーティクル処理[BossHitParticle.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "BossHitParticle.h"
#include "Framework\Easing.h"
#include "Framework\Vector3.h"
/**************************************
マクロ定義
***************************************/
/**************************************
BossHitParticleコンストラクタ
***************************************/
BossHitParticle::BossHitParticle() :
speed(RandomRangef(2.0f, 10.5f))
{
moveDir.x = RandomRangef(-1.0f, 1.0f);
moveDir.y = RandomRangef(-1.0f, 1.0f);
moveDir.z = RandomRangef(-1.0f, 1.0f);
D3DXVec3Normalize(&moveDir, &moveDir);
lifeFrame = RandomRange(10, 30);
}
/**************************************
BossHitParticle初期化処理
***************************************/
void BossHitParticle::Init()
{
transform.scale = Vector3::One * RandomRangef(0.2f, 1.0f);
active = true;
cntFrame = 0;
}
/**************************************
BossHitParticle更新処理
***************************************/
void BossHitParticle::Update()
{
cntFrame++;
float t = (float)cntFrame / lifeFrame;
float currentSpeed = Easing::EaseValue(t, speed, 0.0f, EaseType::InSine);
transform.pos += moveDir * currentSpeed;
transform.scale = Easing::EaseValue(t, 1.0f, 0.0f, EaseType::InCubic) * Vector3::One;
if (cntFrame == lifeFrame)
{
active = false;
}
}
/**************************************
BossHitParticleEmitter初期化処理
***************************************/
void BossHitParticleEmitter::Init()
{
cntFrame = 0;
duration = 5;
active = true;
}
/**************************************
BossHitParticleEmitter更新処理
***************************************/
void BossHitParticleEmitter::Update()
{
cntFrame++;
if (cntFrame == duration)
{
active = false;
}
}
/**************************************
BossHitParticleController初期化処理
***************************************/
void BossHitParticleController::Init()
{
D3DXVECTOR2 temp = D3DXVECTOR2(5.0f, 5.0f);
D3DXVECTOR2 temp2= D3DXVECTOR2(1.0f, 1.0f);
MakeUnitBuffer(&temp, &temp2);
LoadTexture("data/TEXTURE/Effect/EnemyBulletFire.png");
particleContainer.resize(1024);
for (auto&& particle : particleContainer)
{
particle = new BossHitParticle();
}
emitterContainer.resize(64);
for (auto&& emitter : emitterContainer)
{
emitter = new BossHitParticleEmitter();
}
}
/**************************************
BossHitParticleController放出処理
***************************************/
void BossHitParticleController::Emit()
{
ForEachEmitter(15, [](BaseEmitter* emitter, BaseParticle* particle)
{
particle->transform.pos = emitter->transform.pos;
particle->Init();
});
}