Exemple #1
0
void incLevel(nodeTree *root)
{
	if (root == NULL) return;
	if (root->level < 7) root->level++;
	incLevel(root->pLeft);
	incLevel(root->pRight);
}
Exemple #2
0
void soulLand()
{
	nodeTree *oldRoot = myTree->root;
	myTree->root = new nodeTree();
	myTree->root->balance = 0;
	myTree->root->exp = 0;
	myTree->root->key = 777;
	myTree->root->level = 7;
	myTree->root->pLeft = NULL;
	myTree->root->pRight = NULL;

	insertNLR(oldRoot);
	isSoulLand = 1;
	isJack = 1;
	if (_pow(2, getHeight(myTree->root)) - 1 == getCount(myTree->root))
		incLevel(myTree->root);
}
//////////////////////////////////////////////////////////////////////////
// onAttach
void GaStructureComponent::onAttach( ScnEntityWeakRef Parent )
{
	// Get canvas + font.
	Canvas_ = Parent->getComponentAnyParentByType< ScnCanvasComponent >();
	BcAssert( Canvas_ );
	Font_ = Parent->getComponentAnyParentByType< ScnFontComponent >();
	BcAssert( Font_ );
	Sprite_ = Parent->getComponentAnyParentByType< ScnSpriteComponent >();
	BcAssert( Sprite_ );
	Physics_ = getParentEntity()->getComponentByType< GaPhysicsComponent >();
	BcAssert( Physics_ );
	Game_ = getParentEntity()->getComponentAnyParentByType< GaGameComponent >();
	BcAssert( Game_ );

	// Subscribe to hotspot for pressed.
	Parent->subscribe( gaEVT_HOTSPOT_PRESSED, this,
		[ this ]( EvtID, const EvtBaseEvent& InEvent )->eEvtReturn
		{
			const auto& Event = InEvent.get< GaHotspotEvent >();

			return evtRET_PASS;
		} );

	// Begin build phase event
	Game_->getParentEntity()->subscribe( gaEVT_GAME_BEGIN_BUILD_PHASE, this, 
		[ this ]( EvtID, const EvtBaseEvent & Event )
		{
			if( StructureType_ == GaStructureType::RESOURCE )
			{
				Game_->spendResources( -CalculatedResourceRate_ );
			}
			return evtRET_PASS;
		} );

	setActive( Active_ );

	Level_ = 0;
	incLevel();
	Timer_ = BaseFireRate_;
	
	Super::onAttach( Parent );
}
MDCWindow::MDCWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MDCWindow), scene(new QGraphicsScene), TileGFX()
{
    ui->setupUi(this);

    // File menu
    connect(ui->actionOpen_ROM, SIGNAL(triggered()), this, SLOT(actionOpen_ROM()));
    connect(ui->actionSave_ROM, SIGNAL(triggered()), this, SLOT(actionSave_ROM()));
    ui->actionSave_ROM->setDisabled(true);
    connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));

    // Level menup
    connect(ui->actionLoad_Level, SIGNAL(triggered()), this, SLOT(actionLoad_Level()));
    ui->actionLoad_Level->setDisabled(true);

    // Set up buttons
    connect(ui->OpenFileButton, SIGNAL(clicked()), this, SLOT(actionOpen_ROM()));
    connect(ui->SaveFileButton, SIGNAL(clicked()), this, SLOT(actionSave_ROM()));
    ui->SaveFileButton->setDisabled(true);
    connect(ui->OpenLevelButton, SIGNAL(clicked()), this, SLOT(actionLoad_Level()));
    ui->OpenLevelButton->setDisabled(true);
    connect(ui->DecLevelButton, SIGNAL(clicked()), this, SLOT(decLevel()));
    ui->DecLevelButton->setDisabled(true);
    connect(ui->IncLevelButton, SIGNAL(clicked()), this, SLOT(incLevel()));
    ui->IncLevelButton->setDisabled(true);

    // Set up defaults for graphical elements
    ui->graphicsView->setScene(scene);

    // Create array of hardcoded graphics
    for(int i = 0; i < 0x1B; ++i)
    {
        QString tileStr(":/Resources/Tile");
        if(i + 1 < 0x10)
        {
            tileStr.append('0');
        }
        tileStr.append(QString().setNum(i + 1, 16).toUpper());
        TileGFX[i] = QPixmap::fromImage(QImage(tileStr));
    }
}
Exemple #5
0
void Game::Init()
{
    //load fighter modell
    loadFighter("res/models/bearcat.3ds");
    m_Femit.setMaxPartikel(100);

    //load all 7 Levels
    std::string file_prefix = "res/config/level";
    std::string file_postfix = ".xml";

    for(; m_level < 8; incLevel())
    {
        std::stringstream oss;
        oss << file_prefix << m_level << file_postfix;

        std::string level = oss.str();

        getGalaxis()->addLevel( level );
    }

    //we can shoot
    m_shoot = true;
}