forked from YutaTachibana0310/SankouGoudou2019Summer
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BossUIManager.cpp
113 lines (98 loc) · 2.25 KB
/
BossUIManager.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
//=====================================
//
//ボスUIマネージャ処理[BossUIManager.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "BossUIManager.h"
#include "WarningUI.h"
#include "BossBulletGuide.h"
#include "LineTrailModel.h"
#include "camera.h"
#include <algorithm>
#include "sound.h"
/**************************************
マクロ定義
***************************************/
/**************************************
コンストラクタ
***************************************/
BossUImanager::BossUImanager()
{
warning = new WarningUI();
}
/**************************************
デストラクタ
***************************************/
BossUImanager::~BossUImanager()
{
SAFE_DELETE(warning);
for (auto&& guide : bulletGuide)
{
SAFE_DELETE(guide);
}
}
/**************************************
更新処理
***************************************/
void BossUImanager::Update()
{
warning->Update();
for (auto&& guide : bulletGuide)
{
guide->Update();
}
}
/**************************************
描画処理
***************************************/
void BossUImanager::Draw()
{
warning->Draw();
for (auto&& guide : bulletGuide)
{
if(guide->IsActive())
guide->Draw();
}
}
/**************************************
ワーニングセット処理
***************************************/
void BossUImanager::SetWarning()
{
//ワーニングSE
Sound::GetInstance()->SetPlaySE(ALARM, true, (Sound::GetInstance()->changevol / 2.0f));
warning->StartFade(true);
}
/**************************************
バレットガイドセット処理
***************************************/
void BossUImanager::SetBulletGuide(LineTrailModel & model)
{
D3DXVECTOR3 right, left;
model.GetEdgePos(&right, &left);
D3DXVECTOR3 edgeR, edgeL;
Camera::Instance()->Projection(edgeR, right);
Camera::Instance()->Projection(edgeL, left);
const int SetNum = 5;
D3DXVECTOR3 offset = (edgeR - edgeL) / (SetNum + 1);
edgeL += offset;
for (int i = 0; i < SetNum; i++)
{
auto itr = find_if(bulletGuide.begin(), bulletGuide.end(), [](auto&& guide)
{
return !guide->IsActive();
});
if (itr == bulletGuide.end())
{
BossBulletGuide* ptr = new BossBulletGuide();
ptr->Set(edgeL);
bulletGuide.push_back(ptr);
}
else
{
(*itr)->Set(edgeL);
}
edgeL += offset;
}
}