private void SpawnAndSetNextBackground(ParallaxingBackgroundGroup nextBackground)
 {
     mTransitionPulse = TransitionLengthSeconds;
     mNextBackground  = (ParallaxingBackgroundGroup)GameObject.Instantiate(nextBackground);
     mNextBackground.transform.parent   = BackgroundParent.transform;
     mNextBackground.transform.position = BackgroundParent.transform.position + BackgroundCameraOffset;
 }
    private void SetNextGroupAsCurrentAndDeleteCurrent()
    {
        if (mCurrentBackground != null)
        {
            Destroy(mCurrentBackground.gameObject);
        }

        mCurrentBackground = mNextBackground;
        mCurrentBackground.SetAlpha(1f);
        mNextBackground = null;
    }
 public void TransitionToBackground(ParallaxingBackgroundGroup parallaxingBackgroundPrefab)
 {
     if (parallaxingBackgroundPrefab != null)
     {
         if (mNextTransition.Count == 0)
         {
             SpawnAndSetNextBackground(parallaxingBackgroundPrefab);
         }
         else
         {
             mNextTransition.Enqueue(parallaxingBackgroundPrefab);
         }
     }
 }