-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6efc59d
commit 615525f
Showing
14 changed files
with
493 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
//===================================== | ||
// | ||
//ボスコライダーコントローラ処理[BossColliderController.cpp] | ||
//Author:GP12A332 21 立花雄太 | ||
// | ||
//===================================== | ||
#include "BossColliderController.h" | ||
#include "Framework\ResourceManager.h" | ||
#include "BossColliderGuide.h" | ||
|
||
using namespace std; | ||
/************************************** | ||
マクロ定義 | ||
***************************************/ | ||
|
||
/************************************** | ||
コンストラクタ | ||
***************************************/ | ||
BossColliderController::BossColliderController() : posZ(500.0f) | ||
{ | ||
//ポリゴン準備 | ||
ResourceManager::Instance()->MakePolygon("BossColliderEdge", "data/TEXTURE/Enemy/BossColliderEdge.png", D3DXVECTOR2(20.0f, 20.0f)); | ||
ResourceManager::Instance()->MakePolygon("BossColliderLine", "data/TEXTURE/Enemy/BossCollider.png", D3DXVECTOR2(0.5f, 10.0f)); | ||
} | ||
|
||
/************************************** | ||
デストラクタ | ||
***************************************/ | ||
BossColliderController::~BossColliderController() | ||
{ | ||
for (auto&& guide : guideList) | ||
{ | ||
SAFE_DELETE(guide); | ||
} | ||
guideList.clear(); | ||
|
||
for (auto&& collider : colliderList) | ||
{ | ||
SAFE_DELETE(collider); | ||
} | ||
colliderList.clear(); | ||
} | ||
|
||
/************************************** | ||
更新処理 | ||
***************************************/ | ||
void BossColliderController::Update() | ||
{ | ||
for (auto&& guide : guideList) | ||
{ | ||
guide->Update(); | ||
} | ||
} | ||
|
||
/************************************** | ||
描画処理 | ||
***************************************/ | ||
void BossColliderController::Draw() | ||
{ | ||
LPDIRECT3DDEVICE9 pDevice = GetDevice(); | ||
|
||
pDevice->SetRenderState(D3DRS_ZWRITEENABLE, false); | ||
pDevice->SetRenderState(D3DRS_ZENABLE, false); | ||
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); | ||
pDevice->SetRenderState(D3DRS_LIGHTING, false); | ||
|
||
for (auto&& guide : guideList) | ||
{ | ||
guide->Draw(); | ||
} | ||
|
||
pDevice->SetRenderState(D3DRS_ZWRITEENABLE, true); | ||
pDevice->SetRenderState(D3DRS_ZENABLE, true); | ||
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); | ||
pDevice->SetRenderState(D3DRS_LIGHTING, true); | ||
} | ||
|
||
/************************************** | ||
セット処理 | ||
***************************************/ | ||
void BossColliderController::SetCollider(const std::vector<int>& edgeList) | ||
{ | ||
const UINT EdgeMax = edgeList.size() - 1; | ||
for (UINT i = 0; i < EdgeMax; i++) | ||
{ | ||
LineTrailModel model = LineTrailModel(edgeList[i], edgeList[i + 1]); | ||
guideList.push_back(new BossColliderGuide(model)); | ||
|
||
TrailCollider *collider = new TrailCollider(TrailColliderTag::Enemy); | ||
collider->SetTrailIndex(model); | ||
collider->SetAddressZ(&posZ); | ||
|
||
//TODO:コライダーの有効化とオブザーバーの追加 | ||
} | ||
} | ||
|
||
/************************************** | ||
全消去処理 | ||
***************************************/ | ||
void BossColliderController::DeleteAll() | ||
{ | ||
for (auto&& guide : guideList) | ||
{ | ||
SAFE_DELETE(guide); | ||
} | ||
guideList.clear(); | ||
|
||
for (auto&& collider : colliderList) | ||
{ | ||
SAFE_DELETE(collider); | ||
} | ||
colliderList.clear(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//===================================== | ||
// | ||
//ボスコライダーコントローラヘッダ[BossColliderController.h] | ||
//Author:GP12B332 21 立花雄太 | ||
// | ||
//===================================== | ||
#ifndef _BOSSCOLLIDERCONTROLLER_H_ | ||
#define _BOSSCOLLIDERCONTROLLER_H_ | ||
|
||
#include "main.h" | ||
#include "TrailCollider.h" | ||
|
||
#include <list> | ||
#include <vector> | ||
|
||
/************************************** | ||
前方宣言 | ||
***************************************/ | ||
class BossColliderGuide; | ||
|
||
/************************************** | ||
マクロ・列挙子定義 | ||
***************************************/ | ||
|
||
/************************************** | ||
クラス定義 | ||
***************************************/ | ||
class BossColliderController | ||
{ | ||
public: | ||
BossColliderController(); | ||
~BossColliderController(); | ||
|
||
void Update(); | ||
void Draw(); | ||
|
||
void SetCollider(const std::vector<int>& edgeList); | ||
void DeleteAll(); | ||
|
||
private: | ||
std::list<BossColliderGuide*> guideList; | ||
std::list<TrailCollider*> colliderList; | ||
|
||
float posZ; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
//===================================== | ||
// | ||
//ボスコライダーガイド処理[BossColliderGuide.cpp] | ||
//Author:GP12A332 21 立花雄太 | ||
// | ||
//===================================== | ||
#include "BossColliderGuide.h" | ||
#include "Framework\ResourceManager.h" | ||
#include "Framework\Vector3.h" | ||
|
||
/************************************** | ||
マクロ定義 | ||
***************************************/ | ||
|
||
/************************************** | ||
BossColliderGuideコンストラクタ | ||
***************************************/ | ||
BossColliderGuide::BossColliderGuide(LineTrailModel& model) | ||
{ | ||
D3DXVECTOR3 posR, posL; | ||
model.GetEdgePos(&posR, &posL); | ||
|
||
edgeR = new BossColliderEdge(posR); | ||
edgeL = new BossColliderEdge(posL); | ||
|
||
line = new BossColliderLine(posR, posL); | ||
} | ||
|
||
/************************************** | ||
BossColliderGuideデストラクタ | ||
***************************************/ | ||
BossColliderGuide::~BossColliderGuide() | ||
{ | ||
SAFE_DELETE(edgeR); | ||
SAFE_DELETE(edgeL); | ||
|
||
SAFE_DELETE(line); | ||
} | ||
|
||
/************************************** | ||
BossColliderGuide更新処理 | ||
***************************************/ | ||
void BossColliderGuide::Update() | ||
{ | ||
edgeL->Update(); | ||
edgeR->Update(); | ||
} | ||
|
||
/************************************** | ||
BossColliderGuide描画処理 | ||
***************************************/ | ||
void BossColliderGuide::Draw() | ||
{ | ||
line->Draw(); | ||
edgeL->Draw(); | ||
edgeR->Draw(); | ||
} | ||
|
||
/************************************** | ||
BossColliderGuideLineコンストラクタ | ||
***************************************/ | ||
BossColliderLine::BossColliderLine(const D3DXVECTOR3& edgeR, const D3DXVECTOR3& edgeL) | ||
{ | ||
ResourceManager::Instance()->GetPolygon("BossColliderLine", &polygon); | ||
|
||
D3DXVECTOR3 diff = edgeL - edgeR; | ||
|
||
transform = new Transform(); | ||
transform->pos = edgeR + diff / 2.0f; | ||
transform->pos.z = 500.0f; | ||
|
||
transform->scale.x = Vector3::Distance(edgeL, edgeR); | ||
|
||
float angle = Vector3::Angle(Vector3::Right, diff); | ||
D3DXVECTOR3 axis = Vector3::Axis(Vector3::Right, diff); | ||
transform->RotateByAxis(angle, axis); | ||
} | ||
|
||
/************************************** | ||
BossColliderGuideLineデストラクタ | ||
***************************************/ | ||
BossColliderLine::~BossColliderLine() | ||
{ | ||
polygon = NULL; | ||
SAFE_DELETE(transform); | ||
} | ||
|
||
/************************************** | ||
BossColliderGuideLine描画処理 | ||
***************************************/ | ||
void BossColliderLine::Draw() | ||
{ | ||
transform->SetWorld(); | ||
polygon->Draw(); | ||
} | ||
|
||
/************************************** | ||
BossColliderGuideEdgeコンストラクタ | ||
***************************************/ | ||
BossColliderEdge::BossColliderEdge(const D3DXVECTOR3& pos) | ||
{ | ||
ResourceManager::Instance()->GetPolygon("BossColliderEdge", &polygon); | ||
|
||
transform = new Transform(); | ||
transform->pos = pos; | ||
transform->pos.z = 500.0f; | ||
} | ||
|
||
/************************************** | ||
BossColliderGuideEdgeデストラクタ | ||
***************************************/ | ||
BossColliderEdge::BossColliderEdge() | ||
{ | ||
polygon = NULL; | ||
SAFE_DELETE(transform); | ||
} | ||
|
||
/************************************** | ||
BossColliderGuideEdge更新処理 | ||
***************************************/ | ||
void BossColliderEdge::Update() | ||
{ | ||
transform->Rotate(0.0f, 0.0f, 5.0f); | ||
} | ||
|
||
/************************************** | ||
BossColliderGuideEdge描画処理 | ||
***************************************/ | ||
void BossColliderEdge::Draw() | ||
{ | ||
transform->SetWorld(); | ||
polygon->Draw(); | ||
} |
Oops, something went wrong.