本文整理汇总了C++中EntityManager::updateAllEntities方法的典型用法代码示例。如果您正苦于以下问题:C++ EntityManager::updateAllEntities方法的具体用法?C++ EntityManager::updateAllEntities怎么用?C++ EntityManager::updateAllEntities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityManager
的用法示例。
在下文中一共展示了EntityManager::updateAllEntities方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DarkGDK
//.........这里部分代码省略.........
dbCLS( RGB( 0, 0, 0 ) );
camera.update( 0.0 );
//camera.draw();
camera2.update( 0.0 );
//camera2.draw();
// Spawn a new enemy for testing
timeSinceLastSpawn += elapsedTime;
if( timeSinceLastSpawn > timeBetweenSpawns ) {
timeSinceLastSpawn = 0.0;
entityManager.spawnRandomWave();
/*
Enemy *enemy = new Enemy(Vector2D(100.0,-10.0));
// Set up a test path
Path *path = new Path();
path->addWaypoint( Vector2D(200.0,200.0) );
path->addWaypoint( Vector2D(400.0,300.0) );
path->addWaypoint( Vector2D(700.0,-10.0) );
path->setLooped(false);
enemy->setPath( path );
enemy->getStateMachine()->changeState( EnemyFollowPathThenDieState::getInstance() );
entityManager.registerEntity( enemy );
*/
}
// Update and draw the enemies
entityManager.updateAllEntities( elapsedTime );
entityManager.drawAllEntities();
// Reset the first entities position
if( dbMouseClick() == 2 ) {
Vector2D position( dbMouseX(), dbMouseY() );
Vector2D velocity( 0.0, -20.0 );
//Vector2D velocity = target - position;
//velocity.Normalize();
//velocity *= 20.0;
Bullet *bullet = new Bullet(position,velocity);
entityManager.registerEntity( bullet );
}
// Reset the enemies randomly if space pressed
if( dbSpaceKey() && spacePressedLastFrame == false ) {
spacePressedLastFrame = true;
Enemy *enemy = new Enemy();
enemy->setPosition(Vector2D(100.0,-30.0));
// Set up a test path
Path *path = new Path();
path->addWaypoint( Vector2D(200.0,200.0) );
path->addWaypoint( Vector2D(400.0,300.0) );
path->addWaypoint( Vector2D(700.0,-30.0) );
path->setLooped(false);
enemy->setPath( path );
enemy->getStateMachine()->changeState( EnemyFollowPathThenDieState::getInstance() );
entityManager.registerEntity( enemy );
}
if( !dbSpaceKey() )