Play anim, javascript

I have a javascript that switches cameras and I need it to wait for the camera switch and play an anim first.

var camera1 : Camera;
var camera2 : Camera;
var sound1: AudioClip;
var sound2: AudioClip;
 

function Start () {
	camera1.camera.active = true;
	camera2.camera.active = false;
        SwitchCameras();
    }
 
    function Update () {
    //right mouse button
        if(Input.GetMouseButtonDown(1)) {
           SwitchCameras();
           PlayAudio();
        }
   }
    function SwitchCameras(){
        if(camera1.camera.active == false){
            camera1.camera.active = true;
            camera2.camera.active = false;
        }
        else {
            camera1.camera.active = false;
            camera2.camera.active = true;
        }
    }
 
    function PlayAudio(){
        if(camera1.camera.active == true){
            audio.PlayOneShot(sound1);
        }
        else if (camera2.camera.active == true){
            audio.PlayOneShot(sound2);
        }
    }

if(animation.isplayng(“anim name”)){camera.active = true} try this in c# :smiley: