void OnTriggerEnter2D(Collider2D other) { if (other.GetComponent <PlayerController> () != null) { if (!isEquipment && !isHpRegen) { ScoreManager.AddPoints(pointsToAdd); } if (isEquipment) { eq.AddItem(); door.isOpened = true; door.Open(); } if (isHpRegen) { HealthManager.playerHp++; } if (isLifeUp) { life.GiveLife(); } pickedItemSoundEffect.Play(); Destroy(gameObject); } }
public void PickLife() { lifeManager.GiveLife(); spriteRenderer.enabled = false; boxCollider.enabled = false; Destroy(gameObject); }
public void PickLife() { lifeManager.GiveLife(); powerItemExplode.Pickup(); spriteRenderer.enabled = false; Destroy(gameObject); }
void OnTriggerEnter2D(Collider2D other) { if (other.name == "Player") // if player collides with life pickup... { lifeSystem.GiveLife(); // give life Destroy(gameObject); // destroy pickup } }
void OnTriggerEnter2D(Collider2D other) { if (other.name == "Player") { lifeSystem.GiveLife(); Destroy(gameObject); } }
public void OnTriggerEnter2D(Collider2D gameItem) { if (gameItem.tag == "Player") { LifeManager.GiveLife(); } Destroy(gameObject); }
// Update is called once per frame void OnTriggerEnter2D(Collider2D other) { if (other.name == "Player") { lifeSystem.GiveLife(); Instantiate(lifeParticle, transform.position, transform.rotation); Destroy(gameObject); } }
public void PickLife() { lifeManager.GiveLife(); powerItemExplode.Pickup(); spriteRenderer.enabled = false; boxCollider.enabled = false; charMov.ObjetoTriggerPickup(this.name); Destroy(gameObject); }
void OnTriggerEnter2D(Collider2D c) { if (c.name == "Player") { lifeSystem.GiveLife(); pickUpLifeSound.Play(); Destroy(gameObject); } }
public void PickLife() { lifeManager.GiveLife(); audio.PlayOneShot(pickAudio); powerItemExplode.Pickup(); spriteRenderer.enabled = false; boxCollider.enabled = false; Destroy(gameObject); }
void OnTriggerEnter2D(Collider2D other) { if (other.name == "Player") { lifeSystem.GiveLife(); Destroy(gameObject); //If this object hits the player then goes to Give Life function in LifeManager. Then Destroys this object. } }
void OnTriggerEnter2D(Collider2D other) { if (other.name == "Player") { lifeManager.GiveLife(); extraLifeSound.Play(); Destroy(gameObject); } }
//The object must have a collider and set it's settings to Is trigger in order to run this has this mettod.This method will get the collider that will clash with it. void OnTriggerEnter2D(Collider2D col) { //if player pick up this object his life count increses if (col.name == "Player") { lifeSystem.GiveLife(); //TO DO: Optimise Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { lifeSystem.GiveLife(); pickupSound.Play(); Instantiate(pickupEffect, transform.position, transform.rotation); Destroy(gameObject); } }
void OnTriggerEnter2D(Collider2D other) { if (other.name == "MegaMan") { player.pickUpSFX.pitch = 2f; player.pickUpSFX.Play(); lifeSystem.GiveLife(); Destroy(gameObject); } }
void OnTriggerEnter(Collider other) { if (other.gameObject == player) { gameObject.GetComponent <SpriteRenderer>().enabled = false; audio.PlayOneShot(pick); lifeSystem.GiveLife(); powerItemExplode.Pickup(); sphereCollider.enabled = false; Destroy(gameObject); } }
public void onelife() { firstDead = false; lifeSystem.GiveLife(); }
private void OnTriggerEnter2D(Collider2D other) { lifeSystem.GiveLife(); Destroy(gameObject); }