void Start()
    {
        canPlay1  = true;
        canPlay2  = true;
        canPlay3  = true;
        canPlayGo = true;
        Invoke("Play3", 1);
        MusicMan  = GameObject.Find("MusicManager");
        isShaking = false;
        canPause  = false;
        isPaused  = false;
        starting  = false;
        //setting variables to access players and shortcut transforms
        Urial      = GameObject.Find("Urial");
        UrialT     = Urial.GetComponent <Transform>();
        Barachial  = GameObject.Find("Barachial");
        BarachialT = Barachial.GetComponent <Transform>();
        Lilith     = GameObject.Find("Lilith");
        LilithT    = Lilith.GetComponent <Transform>();
        Azazel     = GameObject.Find("Azazel");
        AzazelT    = Azazel.GetComponent <Transform>();

        if (camTransform == null)
        {
            camTransform = GetComponent(typeof(Transform)) as Transform;
        }

        // Create a temporary reference to the current scene.
        curScene = SceneManager.GetActiveScene().buildIndex;

        //sets them to dead to prevent movement
        if (curScene == 8)
        {
            Urial.GetComponent <PlayerScript>().dead     = true;
            Barachial.GetComponent <PlayerScript>().dead = true;
            Azazel.GetComponent <PlayerScript>().dead    = true;
            Lilith.GetComponent <PlayerScript>().dead    = true;
        }
        else if (curScene == 9)
        {
            Urial.GetComponent <FFAPlayerScript>().dead     = true;
            Barachial.GetComponent <FFAPlayerScript>().dead = true;
            Azazel.GetComponent <FFAPlayerScript>().dead    = true;
            Lilith.GetComponent <FFAPlayerScript>().dead    = true;
        }

        //starts zoomed in on Azazel
        Oldpos    = new Vector3(0, 0, -10);
        Targetpos = new Vector3(AzazelT.position.x, AzazelT.position.y, -10);

        //start switching
        Invoke("ChangetoLilith", 1);
    }
 //slight delay to let the camera become big
 void StartVar()
 {
     starting = true;
     if (curScene == 8)
     {
         Urial.GetComponent <PlayerScript>().dead     = false;
         Barachial.GetComponent <PlayerScript>().dead = false;
         Azazel.GetComponent <PlayerScript>().dead    = false;
         Lilith.GetComponent <PlayerScript>().dead    = false;
     }
     else if (curScene == 9)
     {
         Urial.GetComponent <FFAPlayerScript>().dead     = false;
         Barachial.GetComponent <FFAPlayerScript>().dead = false;
         Azazel.GetComponent <FFAPlayerScript>().dead    = false;
         Lilith.GetComponent <FFAPlayerScript>().dead    = false;
     }
     canPause = true;
 }
 // Checking all inputs, and updates visual indicators based on what you are doing
 void Update()
 {
     GetInput();
     ProcessInput();
     if (curCharacter == 1)
     {
         Urial.GetComponent <Image>().enabled = true; Barachial.GetComponent <Image>().enabled = false; Lilith.GetComponent <Image>().enabled = false; Azazel.GetComponent <Image>().enabled = false;
         Player2Character.text = "Urial";
     }
     else if (curCharacter == 2)
     {
         Urial.GetComponent <Image>().enabled = false; Barachial.GetComponent <Image>().enabled = true; Lilith.GetComponent <Image>().enabled = false; Azazel.GetComponent <Image>().enabled = false;
         Player2Character.text = "Barachial";
     }
     else if (curCharacter == 3)
     {
         Urial.GetComponent <Image>().enabled = false; Barachial.GetComponent <Image>().enabled = false; Lilith.GetComponent <Image>().enabled = true; Azazel.GetComponent <Image>().enabled = false;
         Player2Character.text = "Lilith";
     }
     else if (curCharacter == 4)
     {
         Urial.GetComponent <Image>().enabled = false; Barachial.GetComponent <Image>().enabled = false; Lilith.GetComponent <Image>().enabled = false; Azazel.GetComponent <Image>().enabled = true;
         Player2Character.text = "Azazel";
     }
 }
 // Setup for the character images, text, as well as panel color.
 void Start()
 {
     Urial.GetComponent <Image>().enabled      = false; Barachial.GetComponent <Image>().enabled = true; Lilith.GetComponent <Image>().enabled = false; Azazel.GetComponent <Image>().enabled = false;
     Player2Panel.GetComponent <Image>().color = new Vector4(124, 124, 124, 100);
     Player2Text.text      = "Player Two";
     Player2Character.text = "Barachial";
     curCharacter          = 2;
     canSwap  = true;
     selected = false; deselected = true;
     // Get the Rewired Player object for this player and keep it for the duration of the character's lifetime
     player          = ReInput.players.GetPlayer(playerId);
     canSelect       = true;
     MasterSelector  = GameObject.Find("CharacterMaster");
     masterReference = MasterSelector.GetComponent <MasterSelector>();
 }
    void Update()
    {
        //pause logic
        if (Input.GetKeyDown("joystick button 7") && isPaused == false && canPause == true)
        {
            GetComponent <AudioSource>().PlayOneShot(Pause);
            MusicMan.GetComponent <AudioSource>().Pause();
            isPaused = true;
            if (curScene == 8)
            {
                Urial.GetComponent <PlayerScript>().dead     = true;
                Barachial.GetComponent <PlayerScript>().dead = true;
                Azazel.GetComponent <PlayerScript>().dead    = true;
                Lilith.GetComponent <PlayerScript>().dead    = true;
            }
            else if (curScene == 9)
            {
                Urial.GetComponent <FFAPlayerScript>().dead     = true;
                Barachial.GetComponent <FFAPlayerScript>().dead = true;
                Azazel.GetComponent <FFAPlayerScript>().dead    = true;
                Lilith.GetComponent <FFAPlayerScript>().dead    = true;
            }
            shakeDuration = 0;
        }
        else if (Input.GetKeyDown("joystick button 7") && isPaused == true && canPause == true)
        {
            GetComponent <AudioSource>().PlayOneShot(Unpause);
            MusicMan.GetComponent <AudioSource>().Play();
            isPaused = false;
            if (curScene == 8)
            {
                Urial.GetComponent <PlayerScript>().dead     = false;
                Barachial.GetComponent <PlayerScript>().dead = false;
                Azazel.GetComponent <PlayerScript>().dead    = false;
                Lilith.GetComponent <PlayerScript>().dead    = false;
            }
            if (curScene == 9)
            {
                Urial.GetComponent <FFAPlayerScript>().dead     = false;
                Barachial.GetComponent <FFAPlayerScript>().dead = false;
                Azazel.GetComponent <FFAPlayerScript>().dead    = false;
                Lilith.GetComponent <FFAPlayerScript>().dead    = false;
            }

            if (isShaking == true)
            {
                shakeDuration = .5f;
                Invoke("StopShake", .5f);
            }
        }
        //CameraMovement
        if (Targetpos.x == AzazelT.position.x)
        {
            GetComponent <Camera>().orthographicSize = Mathf.Lerp(GetComponent <Camera>().orthographicSize, 2.5f, 5 * Time.deltaTime);
        }
        transform.position = Vector3.MoveTowards(transform.position, Targetpos, 1f);
        if (Targetpos.x == LilithT.position.x)
        {
            // GetComponent<Camera>().orthographicSize = Mathf.Lerp(10.5f, 2.5f, 1);


            transform.position = Vector3.MoveTowards(transform.position, Targetpos, 1f);
        }
        if (Targetpos.x == UrialT.position.x)
        {
            //   GetComponent<Camera>().orthographicSize = Mathf.Lerp(10.5f, 2.5f, 1);
            transform.position = Vector3.MoveTowards(transform.position, Targetpos, 1f);
        }
        if (Targetpos.x == BarachialT.position.x)
        {
            //  GetComponent<Camera>().orthographicSize = Mathf.Lerp(10.5f, 2.5f, 1);
            transform.position = Vector3.MoveTowards(transform.position, Targetpos, 1f);
        }
        if (Targetpos.x == 0)
        {
            if (curScene == 8)
            {
                GetComponent <Camera>().orthographicSize = Mathf.Lerp(GetComponent <Camera>().orthographicSize, 12.5f, 5 * Time.deltaTime);
            }
            else
            {
                GetComponent <Camera>().orthographicSize = Mathf.Lerp(GetComponent <Camera>().orthographicSize, 14, 5 * Time.deltaTime);
            }
            transform.position = Vector3.MoveTowards(transform.position, Targetpos, 1f);
        }
        //resets camera size


        //pausing logic pt2
        if (isPaused)
        {
            BG.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, .5f);
            Time.timeScale = 0;
        }
        else
        {
            if (curScene == 8)
            {
                BG.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1);
            }
            else if (curScene == 9)
            {
                BG.GetComponent <SpriteRenderer>().color = new Color(0.5f, 0.5f, 0.5f, 1);
            }
            Time.timeScale = 1;
        }
        // Camera Shaking
        if (shakeDuration > 0)
        {
            isShaking = true;
            camTransform.localPosition = originalPos + Random.insideUnitSphere * shakeAmount;
            shakeDuration -= Time.deltaTime * decreaseFactor;
        }
        else
        {
            shakeDuration = 0f;
        }
    }