public void Start()
 {
     if (!m_isStarted)
     {
         m_collider          = GetComponent <Collider2D>();
         m_collector         = GetComponent <mg_jr_Collector>();
         m_follower          = GetComponent <mg_jr_Follow>();
         m_animator          = GetComponentInChildren <Animator>();
         m_renderer          = GetComponentInChildren <SpriteRenderer>();
         m_blinker           = GetComponent <mg_jr_Blinker>();
         m_obstacleDestroyer = GetComponent <mg_jr_ObstacleDestroyer>();
         Assert.NotNull(m_collider, "Robotpenguins need a collider");
         Assert.NotNull(m_collector, "Robotpenguins need a collector");
         Assert.NotNull(m_follower, "Robotpenguins need a follower");
         Assert.NotNull(m_animator, "Robotpenguins need an animator");
         Assert.NotNull(m_blinker, "Robotpenguins need an blinker");
         Assert.NotNull(m_obstacleDestroyer, "Robotpenguins need an ObstacleDestroyer");
         SetState(RobotPenguinState.COLLECTABLE);
         m_isStarted = true;
     }
 }
Beispiel #2
0
        public override GameObject Create()
        {
            GameObject gameObject = null;

            gameObject = base.Resources.GetInstancedResource(mg_jr_ResourceList.GAME_PREFAB_ROBOT_PENGUIN);
            Assert.NotNull(gameObject, "No gameobject created.");
            mg_jr_RobotPenguin component = gameObject.GetComponent <mg_jr_RobotPenguin>();

            component.Init(1);
            gameObject.AddComponent <mg_jr_DestroyWhenPastScreen>();
            gameObject.AddComponent <mg_jr_Follow>();
            gameObject.AddComponent <mg_jr_Collector>();
            gameObject.AddComponent <mg_jr_Blinker>();
            mg_jr_ObstacleDestroyer mg_jr_ObstacleDestroyer2 = gameObject.AddComponent <mg_jr_ObstacleDestroyer>();

            mg_jr_ObstacleDestroyer2.enabled = false;
            GameObject     gameObject2 = gameObject.transform.Find("mg_jr_pf_robot_penguin_actual").gameObject;
            SpriteRenderer component2  = gameObject2.GetComponent <SpriteRenderer>();

            component2.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.OBSTACLE_0);
            return(gameObject);
        }
Beispiel #3
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;
        }