private void Update() { if (closing && !damagingPlayer && playerInContact) { damagingPlayer = true; player.TomaDano(); StartCoroutine(Count(2)); } }
void Update() { if (canDealDamage && playerIsInRange && TrapIsWorking && !damagingPlayer) { damagingPlayer = true; player.TomaDano(); StartCoroutine(Count(5)); } }
private void Update() { if (playerInRange) { if (!damagingPlayer) { damagingPlayer = true; player.TomaDano(); StartCoroutine(Count(2)); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Bullet") || collision.gameObject.CompareTag("Trap")) { return; } if (collision.gameObject.CompareTag("Player")) { if (!damagingPlayer) { damagingPlayer = true; player.TomaDano(); StartCoroutine(Count(5)); } } Destroy(this.gameObject); }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.ToString()); if (collision.gameObject.CompareTag("Trap") || collision.gameObject.CompareTag("Bullet") || hitWall) { return; } if (collision.gameObject.CompareTag("Player")) { player.TomaDano(); hitWall = true; Destroy(this.gameObject, 3f); } if (collision.gameObject.CompareTag("Wall")) { hitWall = true; Destroy(this.gameObject, 5f); } }