forked from YutaTachibana0310/SankouGoudou2019Summer
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnemyBulletEffect.cpp
68 lines (57 loc) · 1.73 KB
/
EnemyBulletEffect.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
//=====================================
//
//エネミーバレットエフェクト処理[EnemyBulletEffect.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "EnemyBulletEffect.h"
/**************************************
マクロ定義
***************************************/
#define ENEMYBULLETEFFECT_LIFE_MIN (10)
#define ENEMYBULLETEFFECT_LIFE_MAX (40)
#define ENEMYBULLETEFFECT_DURATION (120)
#define ENEMYBULLETEFECT_POS_RANGE (2.0f)
/**************************************
EnemyBulletEffect初期化処理
***************************************/
void EnemyBulletEffect::Init()
{
cntFrame = 0;
lifeFrame = RandomRange(ENEMYBULLETEFFECT_LIFE_MIN, ENEMYBULLETEFFECT_LIFE_MAX);
transform.Rotate(0.0f, 0.0f, RandomRangef(0.0f, 360.0f));
transform.scale = D3DXVECTOR3(1.0f, 1.0f, 1.0f);
transform.scale *= RandomRangef(0.8f, 1.5f);
transform.pos.x += RandomRangef(-ENEMYBULLETEFECT_POS_RANGE, ENEMYBULLETEFECT_POS_RANGE);
transform.pos.y += RandomRangef(-ENEMYBULLETEFECT_POS_RANGE, ENEMYBULLETEFECT_POS_RANGE);
active = true;
}
/**************************************
EnemyBulletEffect更新処理
***************************************/
void EnemyBulletEffect::Update()
{
cntFrame++;
float t = (float)cntFrame / (float)lifeFrame;
Animation(t);
if (cntFrame == lifeFrame)
active = false;
}
/**************************************
EnemyBulletEffectEmitter初期化処理
***************************************/
void EnemyBulletEffectEmitter::Init()
{
cntFrame = 0;
duration = ENEMYBULLETEFFECT_DURATION;
active = true;
}
/**************************************
EnemyBulletEffectEmitter更新処理
***************************************/
void EnemyBulletEffectEmitter::Update()
{
cntFrame++;
if (cntFrame == duration)
active = false;
}