private void OnCollisionEnter2D(Collision2D collision) //En caso de tocar al jugador, éste muere { Death dead = collision.gameObject.GetComponent <Death>(); if (dead != null) { dead.Dead(); } }
IEnumerator myCor() { if (locked.GetLock(4) == 0) { achievementNotificationController.ShowNotification(database.achievements[4]); locked.Unlock(4); locked.Date(4); moveSpeed = 0f; yield return(new WaitForSeconds(3)); } ded.Dead(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.GetComponent <TurretBullet>() == null) { Destroy(this.gameObject); } Death death = collision.gameObject.GetComponent <Death>(); if (death != null) { death.Dead(); } }
//mata al jugador o al enemigo cuando están activadas private void OnTriggerStay2D(Collider2D collision) { if (shooting) { Enemy_Death dead = collision.gameObject.GetComponent <Enemy_Death>(); if (dead != null) { dead.OnAttack(); } Death death = collision.gameObject.GetComponent <Death>(); if (death != null) { death.Dead(); } } }
//Permite matar al jugador o al enemigo cuando colisionan con la bala //La bala es destruida al colisionar con cualquier cosa. private void OnCollisionEnter2D(Collision2D collision) { death = collision.gameObject.GetComponent <Enemy_Death>(); if (death != null) { death.OnAttack(); } Death dead = collision.gameObject.GetComponent <Death>(); if (dead != null) { dead.Dead(); } Destroy(this.gameObject); }