void Tutorial_Scene::update(float deltaTime)
{
	// watch for unpause button press
	if (_wasPaused && !_game->IsPaused())
	{
		OnResumeGame();
	}
	_wasPaused = _game->IsPaused();
	if (_game->IsPaused() || _game->_countDown > 4)
	{
		return;
	}
	if (!_introMessages.empty())
	{
		Display(_introMessages.front());
		_introMessages.pop_front();
	}
	// watch for new ball type
	for (int i = 0; i < _game->_ballManager->GetNumberOfBalls(); i++)
	{
		Ball* ball = _game->_ballManager->GetBallAtIndex(i);
		if (ball->_wayPointIndex >= 2)//visible on screen
		{
			int ballType = ball->getType();
			auto it = _newBallMessages.find(ballType);
			if (it != _newBallMessages.end())
			{
				Display(it->second);
				_newBallMessages.erase(it);
				break;
			}
		}
	}
	// stop the players winning/losing
    if(_game->_countDown <=0)
    {
	for (auto& player : _game->_players)
	{
		int displayWinLoseMessage = 0;
		const float buffer = 50.0f;
		if (player->getPositionY() < Settings::playerMinY + buffer)
		{
			player->setPositionY(Settings::playerMinY + buffer);
			displayWinLoseMessage = -1;
		}
		else if (player->getPositionY() > Settings::playerMaxY - buffer)
		{
			player->setPositionY(Settings::playerMaxY - buffer);
			displayWinLoseMessage = 1;
		}
		if (displayWinLoseMessage != 0)
		{
			auto it = _winLoseMessages.find(displayWinLoseMessage);
			if (it != _winLoseMessages.end())
			{
				Display(it->second);
				_winLoseMessages.erase(it);
			}
		}
	}
    }

	// watch for new target type
	for (const auto& target : _game->_targets)
	{
		int targetType = target->getType();
		auto it = _newTargetMessages.find(targetType);
		if (it != _newTargetMessages.end())
		{
			Display(it->second);
			_newTargetMessages.erase(it);
		}
	}
}
Exemplo n.º 2
0
void StoryModeScore::OnOkButtonPressed()
{
	if(OnResumeGame.Size() > 0)
		OnResumeGame();
}