#include "stdafx.h" #include "Bomb.h" #include "Bush.h" #include "Materials/DiffuseMaterial.h" #include "Materials/DiffuseAnimatedMaterial.h" #include "Materials/DiffuseOpacityMaterial.h" #include "Player.h" int Bomb::m_Count = 0; std::vector Bomb::m_MaterialIds = {}; PxMaterial* Bomb::m_pPxMaterial{ nullptr }; Bomb::Bomb(GameObject* pPlayer, const XMFLOAT3& startPos, const XMFLOAT4& cameraRot, int power) : m_pPlayer{ pPlayer } , m_StartPos{ startPos } , m_BaseRotation{ cameraRot } , m_Power{ power } { if (m_Count++ == 0) { m_pPxMaterial = PxGetPhysics().createMaterial(.5f, .5f, .5f); auto pMat = MaterialManager::Get()->CreateMaterial(); pMat->SetDiffuseTexture(L"Textures/Bomberman/Bomb/o001e.png"); m_MaterialIds.push_back(pMat->GetMaterialId()); auto pMat2 = MaterialManager::Get()->CreateMaterial(); pMat2->SetDiffuseTexture(L"Textures/Bomberman/Levels/shadow.png"); pMat2->SetOpacityTexture(L"Textures/Bomberman/Levels/shadow_opacity.png"); m_MaterialIds.push_back(pMat2->GetMaterialId()); } m_pAnimatedMaterial = MaterialManager::Get()->CreateMaterial(); m_pAnimatedMaterial->SetDiffuseTexture(L"Textures/Bomberman/Bomb/Explosion/e102_transparent.png"); m_pAnimatedMaterial->SetVariable_Scalar(L"gNrSprites", 16); m_pAnimatedMaterial->SetVariable_Scalar(L"gAnimSpeed", 32); m_pAnimatedMaterial2 = MaterialManager::Get()->CreateMaterial(); m_pAnimatedMaterial2->SetDiffuseTexture(L"Textures/Bomberman/Bomb/Explosion/e101_transparent.png"); m_pAnimatedMaterial2->SetVariable_Scalar(L"gNrSprites", 16); m_pAnimatedMaterial2->SetVariable_Scalar(L"gAnimSpeed", 32); m_pAnimatedMaterial3 = MaterialManager::Get()->CreateMaterial(); m_pAnimatedMaterial3->SetDiffuseTexture(L"Textures/Bomberman/Bomb/Explosion/explosion_transparent.png"); m_pAnimatedMaterial3->SetVariable_Scalar(L"gNrSprites", 1); m_pAnimatedMaterial3->SetVariable_Scalar(L"gAnimSpeed", 1); m_SquishTimer = m_SquishDuration * 2; } void Bomb::DrawImGui() { } void Bomb::Initialize(const SceneContext&) { GetTransform()->Translate(m_StartPos); GetTransform()->Scale(1 + m_Amplitude * 2); m_ModelsContainer = new GameObject(); AddChild(m_ModelsContainer); m_pShadow = new GameObject(); ModelComponent* pShadowModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Bomb_Shadow.ovm", false); pShadowModel->SetMaterial(m_MaterialIds[1]); m_pShadow->AddComponent(pShadowModel); m_ModelsContainer->AddChild(m_pShadow); m_pBase = new GameObject(); m_pBase->GetTransform()->Translate(0, 7.9f /*8.4f*/, 0); m_pBase->GetTransform()->Rotate(XMLoadFloat4(&m_BaseRotation)); ModelComponent* pBaseModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Bomb_Base.ovm", false); pBaseModel->SetMaterial(m_MaterialIds[0]); m_pBase->AddComponent(pBaseModel); m_ModelsContainer->AddChild(m_pBase); m_pFuse = new GameObject(); ModelComponent* pFuseModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Bomb_Top.ovm", false); pFuseModel->SetMaterial(m_MaterialIds[0]); m_pFuse->AddComponent(pFuseModel); m_ModelsContainer->AddChild(m_pFuse); // Flash Particle System ParticleEmitterSettings settings{}; settings.velocity = { 0.f,0.f,0.f }; settings.minSize = 22.f; settings.maxSize = 22.f; settings.minEnergy = 0.f; settings.maxEnergy = 0.1f; settings.minScale = 1.f; settings.maxScale = 2.f; settings.minEmitterRadius = 0.f; settings.maxEmitterRadius = 0.f; settings.color = { 1.f,1.f,1.f,.3f }; GameObject* pFlashContainer = new GameObject(); m_pFuse->AddChild(pFlashContainer); pFlashContainer->GetTransform()->Translate(1.4f, 23.8f, -2.596f); pFlashContainer->AddComponent(new ParticleEmitterComponent(L"Textures/Bomberman/Bomb/flash_particle.png", settings, 7)); // Flame Particle System #1 settings.velocity = { 0.f,0.f,0.f }; settings.minSize = 8.f; settings.maxSize = 8.f; settings.minEnergy = 0.f; settings.maxEnergy = 0.1f; settings.minScale = 1.f; settings.maxScale = 2.f; settings.minEmitterRadius = 0.f; settings.maxEmitterRadius = 0.f; settings.color = { 1.f,1.f,1.f,.7f }; GameObject* pFlameContainer = new GameObject(); m_pFuse->AddChild(pFlameContainer); pFlameContainer->GetTransform()->Translate(1.4f, 23.8f, -1.55f); pFlameContainer->AddComponent(new ParticleEmitterComponent(L"Textures/Bomberman/Bomb/flame01_particle.png", settings, 5)); // Flame Particle System #2 settings.velocity = { 0.f,0.f,0.f }; settings.minSize = 8.f; settings.maxSize = 8.f; settings.minEnergy = 0.f; settings.maxEnergy = 0.5f; settings.minScale = 2.f; settings.maxScale = 1.f; settings.minEmitterRadius = 0.f; settings.maxEmitterRadius = 0.f; settings.color = { 1.f,1.f,1.f,.35f }; GameObject* pFlame2Container = new GameObject(); m_pFuse->AddChild(pFlame2Container); pFlame2Container->GetTransform()->Translate(1.4f, 23.8f, -1.55f); pFlame2Container->AddComponent(new ParticleEmitterComponent(L"Textures/Bomberman/Bomb/flame02_particle.png", settings, 1)); // Collider m_pActor = AddComponent(new RigidBodyComponent(true)); m_pActor->SetCollisionGroup(CollisionGroup::SpawnedBombs); //m_pActor->SetCollisionIgnoreGroups(CollisionGroup::Player0); const auto pPxConvexMesh = ContentManager::Load(L"Meshes/Bomberman/Tile_Collision.ovpc"); m_pActor->AddCollider(PxConvexMeshGeometry(pPxConvexMesh, PxMeshScale({ 1.f, 1.f, 1.f })), *m_pPxMaterial); //Kill Trigger PhysicsCallback killTrigger = [this](GameObject* pTriggerObject, GameObject* pOtherObject, PxTriggerAction action) { pTriggerObject; if (action == PxTriggerAction::ENTER) { Player* pPlayer = dynamic_cast(pOtherObject); if (pPlayer != nullptr) { //PlaySFX /* FMOD::Sound* sound; auto fmodSystem = SoundManager::Get()->GetSystem(); fmodSystem->createSound("Resources/Sounds/explosion.wav", FMOD_DEFAULT, 0, &sound); fmodSystem->playSound(sound, 0, false, 0); */ //Add points if (pPlayer->GetState() != Player::State::WIN && pPlayer->GetState() != Player::State::DEAD) pPlayer->Kill(); } } }; SetOnTriggerCallBack(killTrigger); } void Bomb::Explode(const SceneContext&) { //sfx FMOD::Sound* sound; auto fmodSystem = SoundManager::Get()->GetSystem(); fmodSystem->createSound("Resources/Sounds/explosion.wav", FMOD_DEFAULT, 0, &sound); fmodSystem->playSound(sound, 0, false, 0); // Explosion Particle System ParticleEmitterSettings settings{}; settings.velocity = { 0.f,0.f,0.f }; settings.minSize = 2.f; settings.maxSize = 2.f; settings.minEnergy = 0.5f; settings.maxEnergy = 0.5f; settings.minScale = 20.f; settings.maxScale = 20.f; settings.minEmitterRadius = 0.f; settings.maxEmitterRadius = 0.f; settings.color = { 1.f,1.f,1.f,1.f }; GameObject* pExplosionContainer = new GameObject(); AddChild(pExplosionContainer); pExplosionContainer->GetTransform()->Translate(0, 10.f, 0); pExplosionContainer->AddComponent(new ParticleEmitterComponent(L"Textures/Bomberman/Bomb/Explosion/center_particle.png", settings, 1)); settings.minScale = 22.5f; settings.maxScale = 22.5f; settings.minEnergy = .25f; settings.maxEnergy = .25f; // Explosion Particle System pExplosionContainer->AddComponent(new ParticleEmitterComponent(L"Textures/Bomberman/Bomb/Explosion/sharpnel_particle.png", settings, 1)); //Ray casts XMFLOAT3 pos = GetTransform()->GetWorldPosition(); PxQueryFilterData filterData{}; filterData.data.word0 = ~PxU32(CollisionGroup::SpawnedBombs | CollisionGroup::Bombs); float distanceLeft{ m_Power * 20.f }; PxRaycastBuffer hit{}; if (GetScene()->GetPhysxProxy()->Raycast(PxVec3{ pos.x - 10, 3, pos.z }, PxVec3{ -1, 0, 0 }, distanceLeft, hit, PxHitFlag::eDEFAULT, filterData)) { distanceLeft = hit.block.distance; GameObject* pHitGo = reinterpret_cast(hit.block.actor->userData)->GetGameObject(); Bush* pBush = dynamic_cast(pHitGo); if (pBush != nullptr) pBush->Explode(); //GetScene()->RemoveChild(pHitGo, true); } float nrLeftTiles{ std::floor(distanceLeft / 20.0f) }; float distanceRight{ m_Power * 20.f }; hit = {}; if (GetScene()->GetPhysxProxy()->Raycast(PxVec3{ pos.x + 10, 3, pos.z }, PxVec3{ 1, 0, 0 }, distanceRight, hit, PxHitFlag::eDEFAULT, filterData)) { distanceRight = hit.block.distance; GameObject* pHitGo = reinterpret_cast(hit.block.actor->userData)->GetGameObject(); Bush* pBush = dynamic_cast(pHitGo); if (pBush != nullptr) pBush->Explode(); //GetScene()->RemoveChild(pHitGo, true); } float nrRightTiles{ std::floor(distanceRight / 20.0f) }; float distanceUp{ m_Power * 20.f }; hit = {}; if (GetScene()->GetPhysxProxy()->Raycast(PxVec3{ pos.x, 3, pos.z + 10 }, PxVec3{ 0, 0, 1 }, distanceUp, hit, PxHitFlag::eDEFAULT, filterData)) { distanceUp = hit.block.distance; GameObject* pHitGo = reinterpret_cast(hit.block.actor->userData)->GetGameObject(); Bush* pBush = dynamic_cast(pHitGo); if (pBush != nullptr) pBush->Explode(); //GetScene()->RemoveChild(pHitGo, true); } float nrUpTiles{ std::floor(distanceUp / 20.0f) }; float distanceDown{ m_Power * 20.f }; hit = {}; if (GetScene()->GetPhysxProxy()->Raycast(PxVec3{ pos.x, 3, pos.z - 10 }, PxVec3{ 0, 0, -1 }, distanceDown, hit, PxHitFlag::eDEFAULT, filterData)) { distanceDown = hit.block.distance; GameObject* pHitGo = reinterpret_cast(hit.block.actor->userData)->GetGameObject(); Bush* pBush = dynamic_cast(pHitGo); if (pBush != nullptr) pBush->Explode(); //GetScene()->RemoveChild(pHitGo, true); } float nrDownTiles{ std::floor(distanceDown / 20.0f) }; //std::cout << "distanceLeft = " << distanceLeft << ", NrTiles = " << nrLeftTiles << std::endl; //std::cout << "distanceRight = " << distanceRight << ", NrTiles = " << nrRightTiles << std::endl; //std::cout << "distanceUp = " << distanceUp << ", NrTiles = " << nrUpTiles << std::endl; //std::cout << "distanceDown = " << distanceDown << ", NrTiles = " << nrDownTiles << std::endl << std::endl; // Explosion Fire Animated materials //Base GameObject* pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Translate(0, 3.5f, 0); ModelComponent* pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_Quad.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial3); pExplosionQuad->AddComponent(pExplosionQuadModel); // Center Kill Trigger auto pKillTriggerActor = AddComponent(new RigidBodyComponent(true)); const auto pPxConvexMesh = ContentManager::Load(L"Meshes/Bomberman/Tile_Collision.ovpc"); pKillTriggerActor->AddCollider(PxConvexMeshGeometry(pPxConvexMesh, PxMeshScale({ 1.f, 1.f, 1.f })), *m_pPxMaterial, true, { 0, 0, 0 }); //Lines & Kill Trigger Colliders for (int i{ 1 }; i <= nrDownTiles; i++) { //Line if (i < nrDownTiles) { pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Translate(0, 0, 7.5f + -20.f * i); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_022.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionLines.emplace_back(pExplosionQuad); } // Kill Trigger pKillTriggerActor = AddComponent(new RigidBodyComponent(true)); pKillTriggerActor->AddCollider(PxConvexMeshGeometry(pPxConvexMesh, PxMeshScale({ .7f, 1.f, 1.f })), *m_pPxMaterial, true, { 0, 0, -20.f * i }); } for (int i{ 1 }; i <= nrLeftTiles; i++) { //Line if (i < nrLeftTiles) { pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Translate(-20.f * i + 7.5f, 0, 0); pExplosionQuad->GetTransform()->Rotate(0, 90, 0); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_022.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionLines.emplace_back(pExplosionQuad); } // Kill Trigger pKillTriggerActor = AddComponent(new RigidBodyComponent(true)); pKillTriggerActor->AddCollider(PxConvexMeshGeometry(pPxConvexMesh, PxMeshScale({ 1.f, 1.f, .7f })), *m_pPxMaterial, true, { -20.f * i, 0, 0 }); } for (int i{ 1 }; i <= nrUpTiles; i++) { //Line if (i < nrUpTiles) { pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Translate(0, 0, 20.f * i - 7.5f); pExplosionQuad->GetTransform()->Rotate(0, 180, 0); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_022.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionLines.emplace_back(pExplosionQuad); } // Kill Trigger pKillTriggerActor = AddComponent(new RigidBodyComponent(true)); pKillTriggerActor->AddCollider(PxConvexMeshGeometry(pPxConvexMesh, PxMeshScale({ .7f, 1.f, 1.f })), *m_pPxMaterial, true, { 0, 0, 20.f * i }); } for (int i{ 1 }; i <= nrRightTiles; i++) { //Line if (i < nrRightTiles) { pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Translate(-7.5f + 20.f * i, 0, 0); pExplosionQuad->GetTransform()->Rotate(0, 270, 0); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_022.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionLines.emplace_back(pExplosionQuad); } // Kill Trigger pKillTriggerActor = AddComponent(new RigidBodyComponent(true)); pKillTriggerActor->AddCollider(PxConvexMeshGeometry(pPxConvexMesh, PxMeshScale({ 1.f, 1.f, .7f })), *m_pPxMaterial, true, { 20.f * i, 0, 0 }); } //Bases & Lines - Ends if (nrDownTiles > 0) { // Base End pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_021.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial2); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionBase.emplace_back(pExplosionQuad); // Line End pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Translate(0, 0, (nrDownTiles - 1) * -20.f); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_021.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial2); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionEnds.emplace_back(pExplosionQuad); } if (nrLeftTiles > 0) { // Base pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Rotate(0, 90, 0); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_021.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial2); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionBase.emplace_back(pExplosionQuad); // End pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Translate((nrLeftTiles - 1) * -20.f, 0, 0); pExplosionQuad->GetTransform()->Rotate(0, 90, 0); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_021.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial2); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionEnds.emplace_back(pExplosionQuad); } if (nrUpTiles > 0) { // Base pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Rotate(0, 180, 0); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_021.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial2); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionBase.emplace_back(pExplosionQuad); // End pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Translate(0, 0, (nrUpTiles - 1) * 20.f); pExplosionQuad->GetTransform()->Rotate(0, 180, 0); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_021.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial2); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionEnds.emplace_back(pExplosionQuad); } if (nrRightTiles > 0) { // Base pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Rotate(0, 270, 0); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_021.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial2); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionBase.emplace_back(pExplosionQuad); // End pExplosionQuad = new GameObject(); AddChild(pExplosionQuad); pExplosionQuad->GetTransform()->Translate((nrRightTiles - 1) * 20.f, 0, 0); pExplosionQuad->GetTransform()->Rotate(0, 270, 0); pExplosionQuadModel = new ModelComponent(L"Meshes/Bomberman/Bomb/Explosion_021.ovm", false); pExplosionQuadModel->SetMaterial(m_pAnimatedMaterial2); pExplosionQuad->AddComponent(pExplosionQuadModel); m_pExplosionEnds.emplace_back(pExplosionQuad); } } void Bomb::Update(const SceneContext& sceneContext) { //check if player is outside of bomb collider bounds to enable collision with bomb if (m_pPlayer != nullptr) { XMFLOAT3 playerPos = m_pPlayer->GetTransform()->GetWorldPosition(); XMFLOAT3 bombPos = GetTransform()->GetWorldPosition(); if (std::fabs(playerPos.x - bombPos.x) > 14.5f) { m_pActor->SetCollisionGroup(CollisionGroup::Bombs); m_pPlayer = nullptr; } else if (std::fabs(playerPos.z - bombPos.z) > 14.5f) { m_pActor->SetCollisionGroup(CollisionGroup::Bombs); m_pPlayer = nullptr; } } const float elapsedSec = sceneContext.pGameTime->GetElapsed(); m_pAnimatedMaterial->SetVariable_Scalar(L"gTotalSec", sceneContext.pGameTime->GetTotal()); m_pAnimatedMaterial2->SetVariable_Scalar(L"gTotalSec", sceneContext.pGameTime->GetTotal()); m_pAnimatedMaterial3->SetVariable_Scalar(L"gTotalSec", sceneContext.pGameTime->GetTotal()); if (m_SquishTimer >= m_SquishDuration / 2) { m_SquishTimer -= elapsedSec * 2; m_ScaleStep = sinf(-(m_SquishTimer + (1 - m_SquishDuration * 2) + 0.5f) * XM_PI * 2) * 0.5f; auto mTransform = m_ModelsContainer->GetTransform(); auto mScale = mTransform->GetScale(); mTransform->Scale(mScale.x, (1 - m_Amplitude) + m_ScaleStep, mScale.z); } else { if (m_Lifetime <= 0) { if (m_ModelsContainer != nullptr) { RemoveChild(m_ModelsContainer, true); m_ModelsContainer = nullptr; Explode(sceneContext); } if (m_ExplosionTime > 0) { m_ExplosionTime -= elapsedSec; for (GameObject* pGo : m_pExplosionLines) { pGo->GetTransform()->Scale(1 / 1.5f + m_ExplosionTime / 1.5f, 1, 1); } for (GameObject* pGo : m_pExplosionEnds) { pGo->GetTransform()->Scale(1 / 1.5f + m_ExplosionTime / 1.5f, 1, 1); } for (GameObject* pGo : m_pExplosionBase) { pGo->GetTransform()->Scale(1 / 1.5f + m_ExplosionTime / 1.5f, 1, 1 / 1.5f + m_ExplosionTime / 1.5f); } m_pAnimatedMaterial3->SetVariable_Scalar(L"gOpacityAmount", m_ExplosionTime * 2); if (m_ExplosionTime < 0.25f) { m_pAnimatedMaterial->SetVariable_Scalar(L"gOpacityAmount", m_ExplosionTime * 4); m_pAnimatedMaterial2->SetVariable_Scalar(L"gOpacityAmount", m_ExplosionTime * 4); } } else { GetScene()->RemoveChild(this, true); } } else { m_ScaleStep = sinf(-(m_Lifetime + (1 - m_SquishDuration * 2) + 0.5f) * XM_PI * m_Frequency) * m_Amplitude; auto mTransform = m_ModelsContainer->GetTransform(); mTransform->Scale((1 - m_Amplitude) + m_ScaleStep, (1 - m_Amplitude) + m_ScaleStep, (1 - m_Amplitude) + m_ScaleStep); auto sTransform = m_pShadow->GetTransform(); auto sScale = sTransform->GetScale(); sTransform->Scale((1 - m_Amplitude / 2) + m_ScaleStep / 2, sScale.y, (1 - m_Amplitude / 2) + m_ScaleStep / 2); //Lifetime timer m_Lifetime -= elapsedSec; } } }