Exemplo n.º 1
0
        protected override void OnCaughtBag(mg_bc_Bag _bag)
        {
            mg_bc_JellyBag component = _bag.GetComponent <mg_bc_JellyBag>();

            if (m_heldBagsStack.Count < 5)
            {
                m_tintSprites[m_heldBagsStack.Count].color = mg_bc_Constants.GetColorForJelly(component.Color);
            }
            base.OnCaughtBag(_bag);
        }
Exemplo n.º 2
0
        internal virtual mg_bc_Bag RemoveBag()
        {
            mg_bc_Bag result = null;

            if (m_heldBagsStack.Count > 0)
            {
                result = m_heldBagsStack.Pop();
                UpdateBagCount();
            }
            return(result);
        }
Exemplo n.º 3
0
 internal void TakeBag()
 {
     if (m_penguin != null)
     {
         mg_bc_Bag mg_bc_Bag2 = m_penguin.RemoveBag();
         if (mg_bc_Bag2 != null)
         {
             AddBag(mg_bc_Bag2);
             mg_bc_Bag2.Destroy();
         }
     }
 }
Exemplo n.º 4
0
 internal override void TakeBag()
 {
     if (m_penguin != null)
     {
         mg_bc_Bag mg_bc_Bag2 = m_penguin.RemoveBag();
         if (mg_bc_Bag2 != null)
         {
             mg_bc_JellyBag     component = mg_bc_Bag2.GetComponent <mg_bc_JellyBag>();
             mg_bc_EJellyColors color     = component.Color;
             mg_bc_ScoreController.Instance.OnBagThrownBack(IsTargetColor(color));
             MinigameManager.GetActive().PlaySFX("mg_bc_sfx_BagTossTruck");
             ThrowBack(mg_bc_Bag2);
         }
     }
 }
Exemplo n.º 5
0
 protected virtual void OnCaughtBag(mg_bc_Bag _bag)
 {
     if (_bag.State != mg_bc_EObjectState.STATE_HELD)
     {
         m_heldBagsStack.Push(_bag);
         UpdateBagCount();
         _bag.OnCaught();
         if (!IsDead)
         {
             mg_bc_ScoreController.Instance.OnBagCaught();
         }
         else
         {
             _bag.Destroy();
         }
     }
 }
Exemplo n.º 6
0
        private void ThrowBack(mg_bc_Bag _bag)
        {
            Rigidbody2D component  = _bag.GetComponent <Rigidbody2D>();
            Rigidbody2D component2 = m_penguin.GetComponent <Rigidbody2D>();

            _bag.gameObject.SetActive(value: true);
            component.velocity = Vector2.zero;
            component.position = new Vector2(component2.position.x, component2.position.y + 3f);
            component.AddForce(new Vector2(200f, 600f));
            SpriteRenderer[] componentsInChildren = _bag.GetComponentsInChildren <SpriteRenderer>();
            SpriteRenderer[] array = componentsInChildren;
            foreach (SpriteRenderer spriteRenderer in array)
            {
                spriteRenderer.enabled = false;
            }
            m_lastBagThrownBack = Time.time;
            m_bagsToThrowBack.Add(_bag);
        }
Exemplo n.º 7
0
 private void OnTriggerEnter2D(Collider2D _collider)
 {
     if (!IsDead && m_canCatch)
     {
         mg_bc_Hazard component = _collider.gameObject.GetComponent <mg_bc_Hazard>();
         if (component != null)
         {
             OnHitHazard(component);
         }
         mg_bc_Bag component2 = _collider.gameObject.GetComponent <mg_bc_Bag>();
         if (component2 != null)
         {
             OnCaughtBag(component2);
         }
         mg_bc_Powerup component3 = _collider.gameObject.GetComponent <mg_bc_Powerup>();
         if (component3 != null)
         {
             OnCaughtPowerup(component3);
         }
     }
 }
Exemplo n.º 8
0
        protected override void AddBag(mg_bc_Bag _bag)
        {
            mg_bc_JellyBag     component = _bag.GetComponent <mg_bc_JellyBag>();
            mg_bc_EJellyColors color     = component.Color;

            if (Truck.IsTargetColor(color))
            {
                base.AddBag(_bag);
                GameObject gameObject = m_bags[m_storedBags - 1].transform.GetChild(0).gameObject;
                gameObject.GetComponent <SpriteRenderer>().color = mg_bc_Constants.GetColorForJelly(color);
                if (m_wrongBag != null && m_wrongBagLines != null)
                {
                    Color color2 = m_wrongBagLines.color;
                    color2.a = 1f;
                    m_wrongBagLines.color = color2;
                }
                m_wrongBag      = null;
                m_wrongBagTint  = null;
                m_wrongBagLines = null;
            }
            else
            {
                mg_bc_ScoreController.Instance.OnBagUnloaded(_isCorrect: false);
                MinigameManager.GetActive().PlaySFX("mg_bc_sfx_BagUnloadError");
                if (m_wrongBagsUnloaded % 3 == 0)
                {
                    MinigameManager.GetActive <mg_BeanCounter>().GameLogic.ShowHint("Throw back\nwrong bags!", 2f);
                }
                m_wrongBagsUnloaded++;
                m_wrongBag           = m_bags[m_storedBags];
                m_wrongBagTint       = m_wrongBag.transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>();
                m_wrongBagLines      = m_wrongBag.transform.GetChild(1).gameObject.GetComponent <SpriteRenderer>();
                m_wrongBagTint.color = mg_bc_Constants.GetColorForJelly(color);
                m_wrongBag.SetActive(value: true);
            }
        }
Exemplo n.º 9
0
 protected virtual void AddBag(mg_bc_Bag _bag)
 {
     SetBags(m_storedBags + 1);
     mg_bc_ScoreController.Instance.OnBagUnloaded();
     MinigameManager.GetActive().PlaySFX("mg_bc_sfx_BagUnload");
 }