private int IndexOf(StreamingSection section)
 {
     for(int i=0; i<_streamingSections.Length;i++)
     {
         if(_streamingSections[i] == section)
         {
             return i;
         }
     }
     return -1;
 }
    public void Trigger(uint trigger, GameObject bridge)
    {
        if (trigger == TRIGGER_A && bridge == bridgeB)
            return;
        if (trigger == TRIGGER_B && bridge == bridgeA)
            return;

        _transitioningBridge = bridge;
        _sectionToDestroy = currentSection;
        if (trigger == TRIGGER_A)
        {
            //at the end of the game
            if(IndexOf(currentStreamingSection) == _streamingSections.Length - 1) return;
            _newStreamingSection = _streamingSections[IndexOf(currentStreamingSection)+1];
            currentSection = _newStreamingSection.CreateSection();
            _newBridge = Instantiate(_newStreamingSection.bridgeA);
            Destroy (bridgeB);
            bridgeB = bridgeA;
            bridgeA = _newBridge;
            currentSection.transform.Rotate (currentSection.GetComponent<GameSection>().anchorB.transform.rotation.eulerAngles - bridgeB.GetComponent<SectionBridge>().anchorA.transform.rotation.eulerAngles);
            //bridgeA.transform.Rotate (bridgeA.GetComponent<SectionBridge>().anchorB.transform.rotation.eulerAngles - currentSection.GetComponent<GameSection>().anchorA.transform.rotation.eulerAngles);
            bridgeA.transform.Rotate (currentSection.GetComponent<GameSection>().anchorA.transform.rotation.eulerAngles - bridgeA.GetComponent<SectionBridge>().anchorB.transform.rotation.eulerAngles);
            offset = bridgeB.GetComponent<SectionBridge>().anchorA.transform.position - currentSection.GetComponent<GameSection>().anchorB.transform.position;
            bridgeOffset = offset + (currentSection.GetComponent<GameSection>().anchorA.transform.position - bridgeA.GetComponent<SectionBridge>().anchorB.transform.position);
        }
        else if (trigger == TRIGGER_B)
        {
            //at the beginning of the game
            if(IndexOf(currentStreamingSection) == 0) return;
            _newStreamingSection = _streamingSections[IndexOf(currentStreamingSection)-1];
            currentSection = _newStreamingSection.CreateSection();
            _newBridge = Instantiate(_newStreamingSection.bridgeB);
            Destroy (bridgeA);
            bridgeA = bridgeB;
            bridgeB = _newBridge;

            offset = bridgeA.GetComponent<SectionBridge>().anchorB.transform.position - currentSection.GetComponent<GameSection>().anchorA.transform.position;
            bridgeOffset = offset + (currentSection.GetComponent<GameSection>().anchorB.transform.position - bridgeB.GetComponent<SectionBridge>().anchorA.transform.position);
        }

        _hasLoadedLevel = true;

        _newBridge.transform.parent = _game.transform;

        currentSection.transform.parent = _game.transform;
        currentStreamingSection = _newStreamingSection;

        _currentGameSection = currentSection.GetComponent<GameSection>();

        _game.respawnScene = currentStreamingSection.respawnScene;
        _game.BroadcastMessage("ClearSceneData");
    }