Ejemplo n.º 1
0
        private void Start()
        {
            //we multiply by 2 since we want the bottom of the background to hit the screenTop
            //for such, the top of the background has to hit two the size of the screen top.
            screenTop = ScreenPositionService.GetTopEdge(Camera.main).y * 2;
            currentBackgroundContext = BackgroundContextEnum.Surface_1;
            currentBackground        = BackgroundService.GetBackground(backgroundsPool, currentBackgroundContext);
            BackgroundService.SetPropsForBackgroundContext(backgroundPropsPool, ref currentBackground);


            StartCoroutine(SlideBackground());
        }
Ejemplo n.º 2
0
        private void Update()
        {
            if (currentBackground && currentBackground.position.y > screenTop)
            {
                Debug.Log("Trocar background!");
                //Disable current background
                BackgroundService.DisableCurrentBackground(currentBackground, backgroundPropsPool, backgroundsPool);

                //Get next background Enum
                //currentBackgroundContext = BackgroundService.GetNextContext(currentBackgroundContext, ref 0);

                currentBackground = BackgroundService.GetBackground(backgroundsPool, currentBackgroundContext);
                //Set next background as current
                BackgroundService.SetPropsForBackgroundContext(backgroundPropsPool, ref currentBackground);
            }
        }