00001
00002
00009
00010
#include "entite_joueur.h"
00011
#include "entite_arme.h"
00012
#include "ctrl_son.h"
00013
#include "fx_explosion.h"
00014
00015 CEntiteJoueur::CEntiteJoueur ()
00016 {
00017
m_iBouclier = 100;
00018
m_VitesseI =
m_VitesseF =
CVecteur (0.0f, 0.0f);
00019
m_Acceleration =
CVecteur (0.0f, 0.0f);
00020 m_bTire =
false;
00021
m_uiPoint = 0;
00022 m_pFumee = 0;
00023
m_Timer.
Init ();
00024 }
00025
00026 CEntiteJoueur::~CEntiteJoueur ()
00027 {
00028
00029
CSoundManager::Instance ()->
Jouer (m_pTypeJoueur->
GetSon (), m_pTypeJoueur->
GetNiveau () == 1 ?
CANAL_JOUEUR1 :
CANAL_JOUEUR2);
00030
00031
CExplosion::Create (0, 32, GetPosition (), 128, 1.0f, m_pTypeJoueur->
GetCouleur ());
00032
00033
if (m_pFumee)
00034 m_pFumee->
Supprimer ();
00035 }
00036
00037
00038 CEntiteJoueur*
CEntiteJoueur::Create (
CTypeJoueur* pTypeJoueur)
00039 {
00040
00041
CEntiteJoueur *pEntite =
CEntityManager::Instance ()->
CreateJoueur ();
00042
00043
if (!pEntite)
00044
return 0;
00045
00046 pEntite->
m_pTypeJoueur = pTypeJoueur;
00047 pEntite->
m_PositionI = pEntite->
m_PositionF = pTypeJoueur->
GetPositionSpawn ();
00048
00049 pEntite->
m_pFumee =
CFumee::Create (pEntite, 24, -16.f, -384.f, 0.2f, pTypeJoueur->
GetCouleur ());
00050
return pEntite;
00051 }
00052
00053
00054 void CEntiteJoueur::SetTirer (
bool bTire)
00055 {
00056 m_bTire = bTire;
00057 }
00058
00059 int CEntiteJoueur::GetDommage ()
const
00060
{
00061
return m_pTypeJoueur->
GetDommage ();
00062 }
00063
00064 CTexture*
CEntiteJoueur::GetTexture ()
const
00065
{
00066
return m_pTypeJoueur->
GetTexture ();
00067 }
00068
00069 float CEntiteJoueur::GetTaille ()
const
00070
{
00071
return m_pTypeJoueur->
GetTaille ();
00072 }
00073
00074 void CEntiteJoueur::Action ()
00075 {
00076
00077
if (!m_pTypeArme || !m_bTire)
00078
return;
00079
00080
00081
if (m_TireTimer.
GetTime () > m_pTypeArme->
GetCadence ())
00082 {
00083
00084
CSoundManager::Instance ()->
Jouer (m_pTypeArme->
GetSon (), m_pTypeJoueur->
GetNiveau () == 1 ?
CANAL_JOUEUR1 :
CANAL_JOUEUR2);
00085
00086
for (
unsigned int i = 0; i < m_pTypeArme->
GetAncrageNombre (); i++)
00087
CEntiteArme::Create (m_pTypeArme,
this, m_pTypeArme->
GetAncrageParIndex (i));
00088
00089 m_TireTimer.
Init ();
00090 }
00091 }
00092
00093 void CEntiteJoueur::SetArme (
CTypeArme* pTypeArme)
00094 {
00095 m_pTypeArme = pTypeArme;
00096 }
00097
00098 void CEntiteJoueur::Update ()
00099 {
00100
00101 }
00102
00103
00104 void CEntiteJoueur::AddDommage (
int iDommage)
00105 {
00106 m_iBouclier -= iDommage;
00107
if (m_iBouclier > 100)
00108 m_iBouclier = 100;
00109 }
00110