Пример #1
0
 private void OnRobotPenguinCollected(mg_jr_RobotPenguin _theRoboPenguin)
 {
     if (!AddRobotPenguin(_theRoboPenguin))
     {
         _theRoboPenguin.Recycle();
     }
 }
Пример #2
0
        private bool RemoveRobotPenguin(bool _explode = true)
        {
            bool result = false;

            if (m_guardianRoboPenguins.Count != 0)
            {
                mg_jr_RobotPenguin mg_jr_RobotPenguin2 = m_guardianRoboPenguins[m_guardianRoboPenguins.Count - 1];
                m_guardianRoboPenguins.Remove(mg_jr_RobotPenguin2);
                mg_jr_RobotPenguin2.Collector.CoinCollected             -= OnCoinsCollected;
                mg_jr_RobotPenguin2.Collector.RobotPenguinCollected     -= OnRobotPenguinCollected;
                mg_jr_RobotPenguin2.Collector.TurboCollected            -= OnTuboCollected;
                mg_jr_RobotPenguin2.ObstacleDestroyer.ObstacleDestroyed -= OnCoinsCollected;
                mg_jr_RobotPenguin2.ToggleTurboAnimation(_enable: false);
                if (_explode)
                {
                    mg_jr_RobotPenguin2.Explode();
                }
                else
                {
                    mg_jr_RobotPenguin2.Recycle();
                }
                result = true;
                m_miniGame.GoalManager.AddToProgress(mg_jr_Goal.GoalType.LOSE_ROBOTS, 1f);
            }
            return(result);
        }
Пример #3
0
        public void AddFreeRobotPenguin()
        {
            mg_jr_RobotPenguin pooledResourceByComponent = m_miniGame.Resources.GetPooledResourceByComponent <mg_jr_RobotPenguin>(mg_jr_ResourceList.GAME_PREFAB_ROBOT_PENGUIN);

            pooledResourceByComponent.Start();
            if (!AddRobotPenguin(pooledResourceByComponent))
            {
                m_miniGame.Resources.ReturnPooledResource(pooledResourceByComponent.gameObject);
            }
        }
Пример #4
0
        private void RobotPenguinsToNormal()
        {
            Vector3 offset = new Vector3(0f - m_penguinData.RobotFollowDistance, 0f, 0f);

            for (int i = 0; i < m_guardianRoboPenguins.Count; i++)
            {
                mg_jr_RobotPenguin mg_jr_RobotPenguin2 = m_guardianRoboPenguins[i];
                if (i == 0)
                {
                    mg_jr_RobotPenguin2.MakeFollower(base.gameObject, offset);
                }
                else
                {
                    mg_jr_RobotPenguin2.MakeFollower(m_guardianRoboPenguins[i - 1].gameObject, offset);
                }
                mg_jr_RobotPenguin2.ToggleTurboAnimation(_enable: false);
            }
        }
Пример #5
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);
        }
Пример #6
0
        private bool AddRobotPenguin(mg_jr_RobotPenguin _theRoboPenguin)
        {
            bool result = false;

            if (m_guardianRoboPenguins.Count < 3)
            {
                _theRoboPenguin.transform.parent = base.transform.parent;
                GameObject target = base.gameObject;
                if (m_currentState == PenguinState.FLYING_TURBO)
                {
                    Vector3 localPosition = m_robotTurboPositions[m_guardianRoboPenguins.Count].localPosition;
                    _theRoboPenguin.MakeFollower(target, localPosition, _lockPositionWhenClose: true);
                    _theRoboPenguin.ObstacleDestroyer.enabled = true;
                }
                else
                {
                    Vector3 localPosition = new Vector3(0f - m_penguinData.RobotFollowDistance, 0f, 0f);
                    if (m_guardianRoboPenguins.Count > 0)
                    {
                        target = m_guardianRoboPenguins[m_guardianRoboPenguins.Count - 1].gameObject;
                    }
                    _theRoboPenguin.MakeFollower(target, localPosition);
                }
                m_guardianRoboPenguins.Add(_theRoboPenguin);
                result = true;
                m_miniGame.GoalManager.AddToProgress(mg_jr_Goal.GoalType.COLLECT_ROBOTS, 1f);
                _theRoboPenguin.Collector.CoinCollected             += OnCoinsCollected;
                _theRoboPenguin.Collector.RobotPenguinCollected     += OnRobotPenguinCollected;
                _theRoboPenguin.Collector.TurboCollected            += OnTuboCollected;
                _theRoboPenguin.ObstacleDestroyer.ObstacleDestroyed += OnCoinsCollected;
                _theRoboPenguin.ToggleTurboAnimation(m_currentState == PenguinState.FLYING_TURBO);
                if (m_isBlinking)
                {
                    float phase = m_blinker.CurrentPhase();
                    _theRoboPenguin.Blinker.StartBlinkingFromPhase(phase);
                }
            }
            return(result);
        }