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); }
internal virtual mg_bc_Bag RemoveBag() { mg_bc_Bag result = null; if (m_heldBagsStack.Count > 0) { result = m_heldBagsStack.Pop(); UpdateBagCount(); } return(result); }
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(); } } }
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); } } }
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(); } } }
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); }
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); } } }
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); } }
protected virtual void AddBag(mg_bc_Bag _bag) { SetBags(m_storedBags + 1); mg_bc_ScoreController.Instance.OnBagUnloaded(); MinigameManager.GetActive().PlaySFX("mg_bc_sfx_BagUnload"); }