//-----------------------------------------------------------------------------------------------------
void Level_1_1_part1::onPortal(GameObject *_portal)
{
    //SINGLE MINIGAME MODE
    if( pGameCamera && pGameWorld )
    {
        if( this->getLevelState( "SINGLE_MINIGAME" ) == 1 && _portal->getId() >= 950 && _portal->getId() <= 964 )
        {
            GameObject* pObj = this->getGameObjectById( 777 );
            if( pObj )
            {
                graphic::GraphicAnimationObject* anim = dynamic_cast<graphic::GraphicAnimationObject*>(pObj->getGraphic());
                
                if( anim )
                {
                    //
                    this->pHudScreen->hideSticker();
                    
                    IAudioSource *aSource = MANAGER_Audio->createStaticSource(FALLING_SOUND);
                    if(aSource)
                    {
                        aSource->play();
                        aSource->setAssociate(AudioSourceAssociate::SOUND);
                    }
                    
                    this->embiantSource->changeGainTo( MIN_VOLUME_EMBIENT_MUSIC, 2 );
                    this->backMusicSource->changeGainTo( MIN_VOLUME_EMBIENT_MUSIC, 2 );
                    //
                    auto defeatAction = Sequence::create( DelayTime::create( 2.0f ),
                                                          CallFunc::create( CC_CALLBACK_0( Level_1_1_part1::onDefeat, this ) ), nullptr );
                    GET_RUNNING_SCENE->runAction( defeatAction );
                    
                    _portal->release();
                }
            }
        }
    }
    //
    if(pGameCamera && pGameWorld && this->getLevelState( "SINGLE_MINIGAME" ) != 1 )
    {
        //falling in abyss
        if(_portal->getId() >= 950 && _portal->getId() <= 964)
        {
            this->pHudScreen->hideSticker();
            
            IAudioSource *aSource = MANAGER_Audio->createStaticSource(FALLING_SOUND);
            if(aSource)
            {
                aSource->play();
                aSource->setAssociate(AudioSourceAssociate::SOUND);
            }
            
            this->embiantSource->changeGainTo( MIN_VOLUME_EMBIENT_MUSIC, 2 );
            this->backMusicSource->changeGainTo( MIN_VOLUME_EMBIENT_MUSIC, 2 );
            
            auto defeatAction = Sequence::create( DelayTime::create( 2.0f ),
                                                  CallFunc::create( CC_CALLBACK_0( Level_1_1_part1::onDefeat, this ) ), nullptr );
            GET_RUNNING_SCENE->runAction( defeatAction );

            _portal->release();
        }
        
        //Location triggers-portals
        if( _portal->getId() == 900 )
        {
            if( this->getLevelState( "treble_clef_mg_complete" ) != 1 && this->getLevelState( "seven_notsMiniGame_end" ) != 1 ) //this->getLevelState( "treble_clef_mg" ) != 1 )
            {
                MANAGER_Level->stopLevelTimer();
                this->pHudScreen->hideTimer();
                
                this->pHudScreen->hideSticker();
                this->setLevelState( "treble_clef_mg", 1 );
                this->pDialogScreen->loadDialogFromXml( 0 );
                _portal->release();
            }
        }
        if( _portal->getId() == 901 )
        {
            if( this->getLevelState( "seven_notsMiniGame_end" ) == 1 && this->getLevelState( "treble_clef_mg_complete" ) != 1 )
            {
                this->embiantSource->changeGainTo( MIN_VOLUME_EMBIENT_MUSIC, 2 );
                this->backMusicSource->changeGainTo( MIN_VOLUME_EMBIENT_MUSIC, 2 );
                
                this->pHudScreen->hideSticker();
                MANAGER_Screen->removeScreen( GET_RUNNING_SCENE, screen_id::NOTESMINIGAME );
                this->pDialogScreen->loadDialogFromXml( 5 );
                MANAGER_Screen->addScreen( GET_RUNNING_SCENE, screen_id::MG_L1_1_QUEST_1_3 );
                _portal->release();
            }
        }
        if( _portal->getId() == 902 )
        {
            if( this->getLevelState( "gates_minigames" ) != 1 )
            {
                MANAGER_Level->stopLevelTimer();
                this->pHudScreen->hideTimer();
                
                this->pHudScreen->hideSticker();
                this->setLevelState( "gates_minigames", 1 );
                MANAGER_Screen->addScreen( GET_RUNNING_SCENE, screen_id::MG_L1_1_QUEST_2_1 );
                this->pDialogScreen->loadDialogFromXml( 10 );
            }
        }
        if( _portal->getId() == 906 )
        {
            this->pPlayer->stop();
            this->pHudScreen->resetSticker();
            this->pHudScreen->hideSticker();
            
            //level timer
            MANAGER_Level->stopLevelTimer();
            if( pPlayer->getGameObject()->getLocation() == game_object_location::GROUND )
            {
                MANAGER_Memory->getTempData()->setLevelState( "level_complete", 1 );
                
                GameObject* pObj = this->getGameObjectById( 777 );
                if( pObj )
                {
                    graphic::GraphicAnimationObject* anim = dynamic_cast<graphic::GraphicAnimationObject*>(pObj->getGraphic());
                    
                    if( anim )
                    {
                        anim->setCallbackEndAnimation( graphic::sequence_mob::SM_JOY, [this](){ this->onVictory(); } );
                    }
                }
                this->pHudScreen->hideTimer();
                _portal->release();
            }
        }
        if( _portal->getId() == 909 )
        {
            this->getGameObjectById( 1000 )->getPhysic()->setActivity( false );
        }
    }
}