#include <ClientUpdater.h>
Inheritance diagram for ASR::ClientUpdater:
Public Member Functions | |
ClientUpdater (Client *parentClient) | |
~ClientUpdater () | |
bool | updateBeforeFrame (const FrameEvent &e, const InputReader *inputDevice) |
Called each frame to perform the "update". | |
bool | updateAfterFrame (const FrameEvent &e, const InputReader *inputDevice) |
Private Member Functions | |
void | _findVisibleObjects () const |
void | _showUnit (Unit *unit) const |
void | _hideUnit (Unit *unit) const |
Private Attributes | |
Client * | mClient |
Definition at line 13 of file ClientUpdater.h.
ASR::ClientUpdater::ClientUpdater | ( | Client * | parentClient | ) |
ASR::ClientUpdater::~ClientUpdater | ( | ) |
void ASR::ClientUpdater::_findVisibleObjects | ( | ) | const [private] |
Definition at line 47 of file ClientUpdater.cpp.
References _hideUnit(), _showUnit(), ASR::Level::getEnemyTeams(), ASR::Team::getFogOfWar(), ASR::Level::getSingleton(), ASR::FogOfWar::isUnitVisible(), mClient, and ASR::Client::mTeam.
Referenced by updateBeforeFrame().
00048 { 00049 FogOfWar* fog = mClient->mTeam->getFogOfWar (); 00050 00051 Level::TeamList enemyList = Level::getSingleton ().getEnemyTeams ( mClient->mTeam ); 00052 Level::TeamIterator iter ( enemyList.begin(), enemyList.end() ); 00053 00054 while ( iter.hasMoreElements () ) 00055 { 00056 Team* enemyTeam = iter.getNext (); 00057 TeamUnits::UnitIterator unitIter = enemyTeam->getUnitIterator (); 00058 while ( unitIter.hasMoreElements () ) 00059 { 00060 Unit* enemyUnit = unitIter.getNext (); 00061 00062 // HACK 00063 // Dead units should still be visible as long as they are dying 00064 if ( !enemyUnit->isDead() && fog->isUnitVisible ( enemyUnit ) ) 00065 { 00066 _showUnit ( enemyUnit ); 00067 } 00068 else 00069 { 00070 _hideUnit ( enemyUnit ); 00071 } 00072 } 00073 } 00074 }
void ASR::ClientUpdater::_hideUnit | ( | Unit * | unit | ) | const [private] |
Definition at line 91 of file ClientUpdater.cpp.
Referenced by _findVisibleObjects().
00092 { 00093 unit->getEntity ()->getParentSceneNode ()->setVisible ( false ); 00094 Entity::ChildObjectListIterator iter = unit->getEntity ()->getAttachedObjectIterator (); 00095 while ( iter.hasMoreElements () ) 00096 { 00097 MovableObject* obj = iter.getNext (); 00098 obj->setVisible ( false ); 00099 } 00100 }
void ASR::ClientUpdater::_showUnit | ( | Unit * | unit | ) | const [private] |
Definition at line 78 of file ClientUpdater.cpp.
Referenced by _findVisibleObjects().
00079 { 00080 unit->getEntity ()->getParentSceneNode ()->setVisible ( true ); 00081 Entity::ChildObjectListIterator iter = unit->getEntity ()->getAttachedObjectIterator (); 00082 while ( iter.hasMoreElements () ) 00083 { 00084 MovableObject* obj = iter.getNext (); 00085 obj->setVisible ( true ); 00086 } 00087 }
bool ASR::ClientUpdater::updateAfterFrame | ( | const FrameEvent & | e, | |
const InputReader * | inputDevice | |||
) | [virtual] |
bool ASR::ClientUpdater::updateBeforeFrame | ( | const FrameEvent & | e, | |
const InputReader * | inputDevice | |||
) | [virtual] |
Called each frame to perform the "update".
Return true if rendering should continue, false otherwise.
Implements ASR::Updater.
Definition at line 31 of file ClientUpdater.cpp.
References _findVisibleObjects().
00032 { 00033 _findVisibleObjects (); 00034 00035 return true; 00036 }
Client* ASR::ClientUpdater::mClient [private] |