예제 #1
0
 public void SetDisplayedDevice(mg_jr_TurboDevice _device)
 {
     if (m_displaying != null && m_displaying != _device)
     {
         UnRegisterEvents();
     }
     m_displaying = _device;
     if (m_displaying != null)
     {
         RegisterEvents();
     }
 }
예제 #2
0
        private void Awake()
        {
            m_miniGame  = MinigameManager.GetActive <mg_JetpackReboot>();
            TurboDevice = GetComponent <mg_jr_TurboDevice>();
            if (TurboDevice == null)
            {
                TurboDevice = base.gameObject.AddComponent <mg_jr_TurboDevice>();
            }
            m_collecter = GetComponent <mg_jr_Collector>();
            if (m_collecter == null)
            {
                m_collecter = base.gameObject.AddComponent <mg_jr_Collector>();
            }
            m_obstacleDestroyer                    = GetComponent <mg_jr_ObstacleDestroyer>();
            m_obstacleDestroyer.enabled            = false;
            m_obstacleDestroyer.ObstacleDestroyed += OnCoinsCollected;
            Assert.NotNull(m_obstacleDestroyer, "ObstacleDestroyer  required");
            m_collecter.CoinCollected         += OnCoinsCollected;
            m_collecter.RobotPenguinCollected += OnRobotPenguinCollected;
            m_collecter.TurboCollected        += OnTuboCollected;
            CoinsCollectedSession              = 0;
            m_blinker = GetComponent <mg_jr_Blinker>();
            if (m_blinker == null)
            {
                m_blinker = base.gameObject.AddComponent <mg_jr_Blinker>();
            }
            m_robotTurboPositions[0] = base.transform.Find("mg_jr_TopRobotSocket");
            m_robotTurboPositions[1] = base.transform.Find("mg_jr_MiddleRobotSocket");
            m_robotTurboPositions[2] = base.transform.Find("mg_jr_BottomRobotSocket");
            for (int i = 0; i < m_robotTurboPositions.Length; i++)
            {
                Assert.NotNull(m_robotTurboPositions[i], "Robot turbo position not found");
            }
            m_penguinSpritesContainer = base.transform.Find("mg_jr_penguinSprites").gameObject;
            m_animator = m_penguinSpritesContainer.GetComponent <Animator>();
            Assert.NotNull(m_animator);
            GameObject gameObject = base.transform.Find("mg_jr_penguinSprites/mg_jr_PenguinSprite").gameObject;

            m_penguinRenderer = gameObject.GetComponent <SpriteRenderer>();
            m_penguinRenderer.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.PLAYER_PENGUIN);
            GameObject gameObject2 = base.transform.Find("mg_jr_penguinSprites/mg_jr_Penguin_Thrust").gameObject;

            Assert.NotNull(gameObject2, "Thruster gameobject not found");
            m_thrustRenderer = gameObject2.GetComponent <SpriteRenderer>();
            Assert.NotNull(m_thrustRenderer, "Thruster has no spriterenderer");
            m_thrustRenderer.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.PLAYER_PENGUIN_THRUST);
            GameObject gameObject3 = base.transform.Find("mg_jr_penguinSprites/mg_jr_Penguin_Tint").gameObject;

            Assert.NotNull(gameObject3, "Skin gameobject not found");
            m_skinRenderer = gameObject3.GetComponent <SpriteRenderer>();
            Assert.NotNull(m_skinRenderer, "Skin has no spriterenderer");
            m_skinRenderer.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.TINT);
            GameObject gameObject4 = base.transform.Find("mg_jr_penguinSprites/mg_jr_PenguinTurboDome").gameObject;

            Assert.NotNull(gameObject4, "Skin gameobject not found");
            m_domeRenderer = gameObject4.GetComponent <SpriteRenderer>();
            Assert.NotNull(m_domeRenderer, "Skin has no spriterenderer");
            m_domeRenderer.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.DOME);
            m_mainCamera = Camera.main;
            m_limitUp    = m_mainCamera.orthographicSize - m_penguinData.DistanceToTopOfScreenLimit;
            m_limitDown  = 0f - m_mainCamera.orthographicSize + m_penguinData.DistanceToBottomOfScreenLimit;
        }