forked from YutaTachibana0310/SankouGoudou2019Summer
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BomberFire.cpp
81 lines (68 loc) · 1.64 KB
/
BomberFire.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
//=====================================
//
//ボンバーファイア処理[BomberFire.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "BomberFire.h"
#include "Framework\Easing.h"
/**************************************
マクロ定義
***************************************/
/**************************************
BomberFireコンストラクタ
***************************************/
BomberFire::BomberFire()
{
D3DXVECTOR2 temp = D3DXVECTOR2(8.0f, 8.0f);
SetAnimParameter(&temp);
moveDir.x = RandomRangef(-1.0f, 1.0f);
moveDir.y = RandomRangef(-1.0f, 1.0f);
moveDir.z = RandomRangef(0.5f, 5.0f);
D3DXVec3Normalize(&moveDir, &moveDir);
speed = RandomRangef(5.0f, 10.0f);
lifeFrame = RandomRange(20, 40);
}
/**************************************
BomberFire初期化処理
***************************************/
void BomberFire::Init()
{
cntFrame = 0;
active = true;
}
/**************************************
BomberFire更新処理
***************************************/
void BomberFire::Update()
{
cntFrame++;
float t = (float)cntFrame / lifeFrame;
float currentSpeed = Easing::EaseValue(t, speed, 0.0f, EaseType::InCubic);
transform.pos += moveDir * currentSpeed;
Animation(t);
if (cntFrame == lifeFrame)
{
active = false;
}
}
/**************************************
BomberFireEmitter初期化処理
***************************************/
void BomberFireEmitter::Init()
{
cntFrame = 0;
duration = 3;
active = true;
}
/**************************************
BomberFireEmitter更新処理
***************************************/
void BomberFireEmitter::Update()
{
cntFrame++;
if (cntFrame == duration)
{
active = false;
}
}