Skip to content

Commit

Permalink
ボンバー発射時のパーティクルを実装
Browse files Browse the repository at this point in the history
  • Loading branch information
YutaTachibana0310 committed Aug 14, 2019
1 parent 597ebde commit a73be57
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 1 deletion.
4 changes: 4 additions & 0 deletions 20190529_01三校合同2019夏.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
<ClInclude Include="BackGroundRoad.h" />
<ClInclude Include="battleStartTelop.h" />
<ClInclude Include="BaseEditWindow.h" />
<ClInclude Include="BomberFire.h" />
<ClInclude Include="BomberFireController.h" />
<ClInclude Include="BomberStockEffect.h" />
<ClInclude Include="ChangeEditWindow.h" />
<ClInclude Include="ChangeEnemyFactory.h" />
Expand Down Expand Up @@ -321,6 +323,8 @@
<ClCompile Include="BackGuroundField.cpp" />
<ClCompile Include="battleStartTelop.cpp" />
<ClCompile Include="BaseEditWindow.cpp" />
<ClCompile Include="BomberFire.cpp" />
<ClCompile Include="BomberFireController.cpp" />
<ClCompile Include="BomberStockEffect.cpp" />
<ClCompile Include="ChangeEditWindow.cpp" />
<ClCompile Include="ChangeEnemyFactory.cpp" />
Expand Down
12 changes: 12 additions & 0 deletions 20190529_01三校合同2019夏.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,12 @@
<ClInclude Include="Framework\CameraShakePlugin.h">
<Filter>ヘッダー ファイル\Framework</Filter>
</ClInclude>
<ClInclude Include="BomberFire.h">
<Filter>ヘッダー ファイル\Effect\Particle</Filter>
</ClInclude>
<ClInclude Include="BomberFireController.h">
<Filter>ヘッダー ファイル\Effect\Controller</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="camera.cpp">
Expand Down Expand Up @@ -1220,6 +1226,12 @@
<ClCompile Include="Framework\CameraShakePlugin.cpp">
<Filter>ソース ファイル\Framework</Filter>
</ClCompile>
<ClCompile Include="BomberFire.cpp">
<Filter>ソース ファイル\Effect\Particle</Filter>
</ClCompile>
<ClCompile Include="BomberFireController.cpp">
<Filter>ソース ファイル\Effect\Controller</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<FxCompile Include="Shaders\BloomFilter.fx">
Expand Down
80 changes: 80 additions & 0 deletions BomberFire.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//=====================================
//
//ボンバーファイア処理[BomberFire.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "BomberFire.h"
#include "Framework\Easing.h"

/**************************************
マクロ定義
***************************************/

/**************************************
BomberFireコンストラクタ
***************************************/
BomberFire::BomberFire()
{
SetAnimParameter(&D3DXVECTOR2(8.0f, 8.0f));

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;
}
}
44 changes: 44 additions & 0 deletions BomberFire.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//=====================================
//
//ボンバーファイアヘッダ[BomberFire.h]
//Author:GP12B332 21 立花雄太
//
//=====================================
#ifndef _BOBMERFIRE_H_
#define _BOBMERFIRE_H_

#include "main.h"
#include "Framework\AnimationParticle.h"
#include "Framework\BaseEmitter.h"

/**************************************
マクロ定義
***************************************/

/**************************************
BomberFireクラス
***************************************/
class BomberFire : public AnimationParticle
{
public:
BomberFire();

void Init();
void Update();

private:
D3DXVECTOR3 moveDir;
float speed;
};

/**************************************
BomberFireEmitterクラス
***************************************/
class BomberFireEmitter : public BaseEmitter
{
public:
void Init();
void Update();
};

#endif
55 changes: 55 additions & 0 deletions BomberFireController.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//=====================================
//
//ボンバーファイアコントローラ処理[BomberFireController.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "BomberFireController.h"
#include "BomberFire.h"

/**************************************
マクロ定義
***************************************/
#define BOBMERFIRE_TEXTURE_NAME "data/TEXTURE/Effect/BomberFire.png"
#define BOMBERFIRE_TEXTURE_DIV (&D3DXVECTOR2(8.0f, 8.0f))
#define BOMBERFIRE_SIZE (&D3DXVECTOR2(5.0f, 5.0f))
#define BOMBERFIRE_NUM_MAX (512)
#define BOMBERFIRE_EMITTER_NUM (1)
#define BOMBERFIRE_EMIT_NUM (170)

/**************************************
初期化処理
***************************************/
void BomberFireController::Init()
{
//単位頂点バッファ作成、テクスチャロード
MakeUnitBuffer(BOMBERFIRE_SIZE, BOMBERFIRE_TEXTURE_DIV);
LoadTexture(BOBMERFIRE_TEXTURE_NAME);

//パラメータコンテナ作成
particleContainer.resize(BOMBERFIRE_NUM_MAX);
for (auto& particle : particleContainer)
{
particle = new BomberFire();
}

//エミッタコンテナ作成
emitterContainer.resize(BOMBERFIRE_EMITTER_NUM);
for (auto& emitter : emitterContainer)
{
emitter = new BomberFireEmitter();
}
}

/**************************************
放出処理
***************************************/
void BomberFireController::Emit()
{
ForEachEmitter(BOMBERFIRE_EMIT_NUM, [](BaseEmitter* emitter, BaseParticle* particle)
{
particle->transform.pos = emitter->transform.pos;
particle->Init();
});
}

27 changes: 27 additions & 0 deletions BomberFireController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//=====================================
//
//ボンバーファイアコントローラヘッダ[BomberFireController.h]
//Author:GP12B332 21 立花雄太
//
//=====================================
#ifndef _BOMBERFIRECONTROLLER_H_
#define _BOMBERFIRECONTROLLER_H_

#include "main.h"
#include "Framework\BaseParticleController.h"

/**************************************
マクロ定義
***************************************/

/**************************************
クラス定義
***************************************/
class BomberFireController : public BaseParticleController
{
public:
void Init();
void Emit();
};

#endif
12 changes: 12 additions & 0 deletions GameParticleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "PlayerChargeEffectController.h"
#include "PlayerChargeParticleController.h"
#include "AccelEffectController.h"
#include "BomberFireController.h"

#include "LineTrailModel.h"

Expand Down Expand Up @@ -56,6 +57,7 @@ enum ParticleController
PlayerCharge,
PlayerChargeParticle,
AccelEffect,
BomberFire,
ControllerMax
};

Expand Down Expand Up @@ -84,6 +86,7 @@ void GameParticleManager::Init()
controllers[PlayerCharge] = new PlayerChargeEffectController();
controllers[PlayerChargeParticle] = new PlayerChargeParticleController();
controllers[AccelEffect] = new AccelEffectController();
controllers[BomberFire] = new BomberFireController();

//各パーティクル初期化
for (auto& controller : controllers)
Expand All @@ -109,6 +112,7 @@ void GameParticleManager::Update(void)
***************************************/
void GameParticleManager::UpdateBombParticle()
{
controllers[BomberFire]->Update();
controllers[PlayerBomberParticle]->Update();
controllers[PlayerChargeParticle]->Update();
controllers[PlayerCharge]->Update();
Expand Down Expand Up @@ -223,6 +227,14 @@ void GameParticleManager::SetAccelEffect(D3DXVECTOR3 *pos)
controllers[AccelEffect]->SetEmitter(pos);
}

/**************************************
ボンバー発射エフェクトセット処理
***************************************/
void GameParticleManager::SetBomberFire(D3DXVECTOR3* pos)
{
controllers[BomberFire]->SetEmitter(pos);
}

#ifdef GAMEPARTICLE_USE_DEBUG
/**************************************
デバッグウィンドウ
Expand Down
1 change: 1 addition & 0 deletions GameParticleManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class GameParticleManager :
void SetPlayerCharge(D3DXVECTOR3 *pos);
void SetAccelEffect(D3DXVECTOR3 *pos);
void SetEnemyBulletExplosion(D3DXVECTOR3 *pos);
void SetBomberFire(D3DXVECTOR3 *pos);

private:
GameParticleManager() {}
Expand Down
6 changes: 5 additions & 1 deletion PlayerBomberController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <algorithm>
#include "Framework\ResourceManager.h"
#include "enemy.h"
#include "GameParticleManager.h"

using namespace std;

Expand Down Expand Up @@ -156,7 +157,7 @@ void PlayerBomberController::Draw()
***************************************************/
void PlayerBomberController::SetPlayerBomber(list<Enemy*>targetList, D3DXVECTOR3 initpos)
{
const D3DXVECTOR3 setPos = initpos + D3DXVECTOR3(0.0f, 10.0f, 50.0f);
D3DXVECTOR3 setPos = initpos + D3DXVECTOR3(0.0f, 10.0f, 50.0f);
float rotAngle = D3DXToRadian(360.0f / targetList.size());
float radian = 0.0f;

Expand Down Expand Up @@ -193,6 +194,9 @@ void PlayerBomberController::SetPlayerBomber(list<Enemy*>targetList, D3DXVECTOR3

//ストックを消費
stock--;

//発射エフェクトセット
GameParticleManager::Instance()->SetBomberFire(&setPos);
}

/***************************************************
Expand Down
Binary file added data/TEXTURE/Effect/BomberFire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a73be57

Please sign in to comment.