00001
00002
00009
00010
#include "affichage.h"
00011
#include "ctrl_fenetre.h"
00012
#include "ctrl_particule.h"
00013
#include "fx_etoile.h"
00014
00015 CEtoile::CEtoile (
CTexture *pTexture)
00016 {
00017
m_pTexture = pTexture;
00018 }
00019
00020 CEtoile::~CEtoile ()
00021 {
00022
00023 }
00024
00025
00026 const CEtoile*
CEtoile::Create ()
00027 {
00028
00029
CEtoile* pGenerateurParticule =
CParticleManager::Instance ()->
CreateEtoile ();
00030
if (pGenerateurParticule == 0)
00031
return 0;
00032
00033 pGenerateurParticule->
m_fTailleParticule = 4;
00034 pGenerateurParticule->
m_fVitesseMin = 48;
00035 pGenerateurParticule->
m_fVitesseMax = 96;
00036 pGenerateurParticule->
m_fDureeVie = 100.f;
00037 pGenerateurParticule->
m_Couleur =
CCouleur (1.0f, 1.0f, 1.0f);
00038
00039
return pGenerateurParticule;
00040 }
00041
00042
00043 void CEtoile::Init ()
00044 {
00045
00046 }
00047
00048
00049 void CEtoile::Update ()
00050 {
00051
for (
int i = 0; i <
PARTICULE_NOMBRE; i++)
00052 {
00053
if (m_pParticule[i])
00054 {
00055
00056
if (m_pParticule[i]->
GetPosition () (gtl::Y) < 0)
00057 {
00058
delete m_pParticule[i];
00059 m_pParticule[i] = 0;
00060
continue;
00061 }
00062 }
00063 }
00064
00065
if (m_Timer.
GetTime () > 0.1)
00066 {
00067 m_Timer.
Init ();
00068
int iIndex =
GetIndexLibre ();
00069
if (iIndex != -1)
00070 m_pParticule[iIndex] =
new CParticule (
CVecteur (
RandFloat (0,
FENETRE_LARGEUR),
FENETRE_HAUTEUR),
CVecteur (0, -
RandFloat (m_fVitesseMin, m_fVitesseMax)),
CVecteur (0, 0), 5, 10);
00071 }
00072 }