本文整理汇总了C++中Obstacle::GetPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Obstacle::GetPos方法的具体用法?C++ Obstacle::GetPos怎么用?C++ Obstacle::GetPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obstacle
的用法示例。
在下文中一共展示了Obstacle::GetPos方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateObstacle
void sv::ObstacleManager::UpdateLevel(ulong deltaTime)
{
m_PassedTime += deltaTime;
if(m_PassedTime > SPAWN_TIME_OB)
{
m_PassedTime -= SPAWN_TIME_OB;
m_Step ++;
if(m_Step == m_LevelSize)
m_Step = 0;
ObstacleMsg obstacleMsg;
bool obstacleCreated = false;
for(uchar i=0; i<GetGrid()->GetNumberLanes(); ++i)
{
if(m_Level[m_Step][i] != ' ')
{
uchar category = m_Level[m_Step][i] - 'a' +1;
Obstacle* ob = CreateObstacle(category, i);
obstacleMsg.AddObstacle(ob->GetId(), category, ob->GetPos());
obstacleCreated = true;
}
}
if(obstacleCreated)
GetGame()->SendMsg(&obstacleMsg);
}
}
示例2: First
void sv::ObstacleManager::Update(ulong deltaTime)
{
Iterator iter = First();
while(iter)
{
Obstacle* obstacle = Get(iter);
iter = Next(iter);
obstacle->Update(deltaTime);
if( obstacle->IsEdge() )
HandleCollision(obstacle);
if( obstacle->GetPos() == Grid::InvalidPos )
DeleteObstacle(obstacle);
}
UpdateLevel(deltaTime);
}