forked from YutaTachibana0310/SankouGoudou2019Summer
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BossIdle.cpp
52 lines (43 loc) · 1.25 KB
/
BossIdle.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
//=====================================
//
//ボスアイドル処理[BossIdle.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "BossIdle.h"
#include "BossEnemyActor.h"
/**************************************
マクロ定義
***************************************/
/**************************************
入場処理
***************************************/
void BossEnemyModel::BossIdle::OnStart(BossEnemyModel * entity)
{
entity->actor->ChangeAnimation(BossEnemyActor::AnimID::Idle);
cntFrame = 0;
if (entity->cntLoop == 2)
{
entity->cntLoop = 0;
entity->ChangeState(BossEnemyModel::State::Damageable);
}
}
/**************************************
更新処理
***************************************/
int BossEnemyModel::BossIdle::OnUpdate(BossEnemyModel * entity)
{
cntFrame++;
const int Duration = 60;
int next = BossEnemyModel::State::Idle;
if (cntFrame == Duration)
{
if (entity->prevState == BossEnemyModel::State::HomingAttack)
next = BossEnemyModel::State::RebarAttack;
else if (entity->prevState == BossEnemyModel::State::RebarAttack)
next = BossEnemyModel::State::HomingAttack;
else
next = RandomRange(0, 100) < 50 ? BossEnemyModel::State::RebarAttack : BossEnemyModel::State::HomingAttack;
}
return next;
}