private void OnCaughtPowerup(mg_bc_Powerup _powerup) { switch (_powerup.PowerupType) { case mg_bc_EPowerupType.EXTRA_LIFE: Lives.SetValue(Lives.Value + 1); GameLogic.OnPenguinGainLife(); break; case mg_bc_EPowerupType.INVINCIBILITY: StartShield(); break; } _powerup.OnCaught(); _powerup.Destroy(); }
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); } } }