private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { if (hp.GetLife() != hp.GetMaxLife()) { hp.AddLife(1); HUDManager.singletone.UpdateLife(hp.GetLife(), hp.GetMaxLife()); Instantiate(VFX_PickUp, collision.transform.position, Quaternion.identity, collision.transform); Destroy(gameObject); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { hp.AddMaxLife(1); hp.AddLife(999); GameManager.singletone.SetLifePlayerHUD(hp.GetLife(), hp.GetMaxLife()); foreach (GameObject go in VFX_PickUps) { Instantiate(go, collision.transform.position + (Vector3.down * 40), transform.rotation = Quaternion.Euler(-100, 0, 0), collision.transform); } Destroy(gameObject); } }
private void OnEnable() { healthPlayer = GetComponent <HealthPlayer>(); Debug.Log("vidas restantes " + healthPlayer.LivesRemaining()); Debug.Log(healthPlayer.maxHealth); for (int i = 0; i < lives; i++) { if (healthPlayer.LivesRemaining() < healthPlayer.maxHealth) { healthPlayer.AddLife(); } } Debug.Log("vidas tras curarte" + healthPlayer.LivesRemaining()); DisableSandwich(); }