Exploder.cpp
资源名称:g.rar [点击查看]
上传用户:laitongbao
上传日期:2021-02-20
资源大小:8176k
文件大小:1k
源码类别:
射击游戏
开发平台:
Visual C++
- // Exploder.cpp: implementation of the Exploder class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "Exploder.h"
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- Particle_Emit *g_explode;
- P_Resistance *g_resistance;
- Exploder::Exploder(float particle_size,int numParticles,float speed)
- {
- static bool init = false;
- if(!init)
- {
- g_explode = (Particle_Emit*)g_tree->AddObject( &Particle_Emit("Exploder",5.f,2.f,"Fire/explode1.bmp",
- 0xffffffff,0x00000000,VECTOR3()),(NodeObject*)NULL);
- g_resistance = (P_Resistance*)g_tree->AddObject(new P_Resistance("exp_resis"),(NodeObject*)NULL);
- g_resistance->AddObject(g_explode);
- init = true;
- }
- g_resistance->SetPower(0.05f);
- this->emit = g_explode;
- exploded = false;
- this->particle_size =particle_size ;
- this->numParticles = numParticles;
- this->speed = speed;
- }
- Exploder::Explode(VECTOR3 pos)//只能爆炸一次,pos设置爆炸位置
- {
- if(!exploded)
- { TransitionController::SetWorldPosition(emit,pos);
- emit->SetSize(particle_size);
- emit->Emit(VECTOR3(speed,0.f,0.f),numParticles,true,1.f);
- exploded = true;
- }
- }
- void Exploder::Reset()
- {
- exploded = false;
- }
- Exploder::~Exploder()
- {
- }