Scriptname _00E_ComplexAddSilenceDuringScenesSC extends ObjectReference  

;=====================================================================================
;                                       EVENTS                                       
;=====================================================================================

Event OnTriggerEnter(ObjectReference akActionRef)

    If akActionRef == PlayerREF
    
        int iSceneIndex = scenesArray.Length - 1
        bool bASceneIsPlaying
        
        while iSceneIndex >= 0 && !bASceneIsPlaying
            
            If scenesArray[iSceneIndex].IsPlaying()
                bASceneIsPlaying = True
                silenceToAdd.Add()
            Else
                iSceneIndex -= 1
            EndIf
        
        EndWhile
        
        silenceToAdd.Remove()
        
    EndIf
    
EndEvent

Event OnTriggerLeave(ObjectReference akActionRef)

    If akActionRef == PlayerREF
        silenceToAdd.Remove()
    EndIf

EndEvent

;=====================================================================================
;                                       PROPERTIES                                       
;=====================================================================================

Scene[] Property scenesArray Auto

MusicType Property silenceToAdd Auto

Actor Property PlayerREF Auto