本文整理汇总了C++中Floor::addSpeed方法的典型用法代码示例。如果您正苦于以下问题:C++ Floor::addSpeed方法的具体用法?C++ Floor::addSpeed怎么用?C++ Floor::addSpeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor::addSpeed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateScene
void ColoredCubeApp::updateScene(float dt)
{
D3DApp::updateScene(dt);
float gameTime = mTimer.getGameTime();
if (gameTime > 1.0f && !gameOver)
{
////// New Stuff added by Steve //////
player.move(dt);
player.update(dt);
//new clustered cube code
floorMovement += floor.getSpeed() * dt;
if (floorMovement > clusterSeparation)
{
floorMovement = 0.0f;
setNewObstacleCluster();
floorClusterCounter++;
}
if (floorClusterCounter > floorClusterThreshold)
{
floorClusterCounter = 0;
floor.addSpeed((float)floorSpeedIncrease);
clusterSeparation--;
cubeSeparation--;
if (cubeSeparation < 12)
cubeSeparation = 12;
if (clusterSeparation < cubeSeparation * (clusterSize + clusterSizeVariation / 2))
clusterSeparation = cubeSeparation * (clusterSize + clusterSizeVariation / 2);
}
for (int i = 0; i < numberOfObstacles; i++) {
obstacles[i].setSpeed(floor.getSpeed());
float zPos = obstacles[i].getPosition().z;
if (zPos > 100 && zPos < 130)
for (int f=0; f<floor.size(); ++f)
{
if (floor.section(f).contains(Vector3(0, -2, zPos)))
{
DXColor compliment = floor.section(f).colorAtPoint(zPos);
compliment.r = 1.0f - compliment.r;
compliment.g = 1.0f - compliment.g;
compliment.b = 1.0f - compliment.b;
obstacles[i].setColor(compliment);
break;
}
}
obstacles[i].update(dt);
if (player.isWithin(12.0f, &obstacles[i]))
{
if (player.collided(&obstacles[i]))
{
gameOver = true;
audio->playCue(GAME_OVER);
}
}
}
for(int i = 0; i < 6; i++) {
spectrum[i].update(dt);
}
float cursorPos = player.getWheelVal();
cursor.setPosition(Vector3(10.2f,24.0f,-5.0f) + 2*Vector3(cursorPos, 0.0f, 0.0f));
cursor.update(dt);
xLine.update(dt);
yLine.update(dt);
zLine.update(dt);
//////////////////////////////////////
// Floor test code //
/*for (int i=0; i<floor.size(); ++i)
{
floor[i].update(dt);
float zPos = floor[i].getPosition().z;
if (zPos < -50)
floor[i].setPosition(Vector3(0, -2, zPos + floor.size() * floorSectionLength));
}*/
//Changes By: Daniel J. Ecker
}
floor.update(dt);
// Build the view matrix.
D3DXVECTOR3 pos(0.0f,45.0f,-50.0f);
D3DXVECTOR3 target(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 up(0.0f, 1.0f, 0.0f);
D3DXMatrixLookAtLH(&mView, &pos, &target, &up);
input->clearAll();
}