private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player" && _isEnemyBeam == true) { OnDamagePlayer?.Invoke(-_damage); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player" && _isEnemyMissile == true) { OnDamagePlayer?.Invoke(-_damage); gameObject.SetActive(false); } }
void OnTriggerStay(Collider col) { if (canHit && col.gameObject.CompareTag("Player")) { animator.SetBool("isAttacking", true); OnDamagePlayer.Invoke(this); StartCoroutine("DelayBetweenHit", timeBetweenHit); } }
void OnTriggerEnter(Collider collider) { if (!GetComponentInParent <Enemy>().isDead) { if (collider.gameObject.tag == "Player") { OnDamagePlayer?.Invoke(collider.gameObject); } } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { OnDamagePlayer?.Invoke(-1); Damage(); } if (other.tag == "Laser") { other.gameObject.SetActive(false); Damage(); } if (other.tag == "Omni Shot") { Damage(); } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { OnDamagePlayer?.Invoke(-_damage); int explosionID = _explosionPrefab.GetExplosionID(); GameObject explosion = OnGetExplosion?.Invoke(explosionID); if (explosion != null) { explosion.transform.position = transform.position; explosion.SetActive(true); } gameObject.SetActive(false); } if (other.tag == "Laser") { OnScored?.Invoke(_scoreValue); other.gameObject.SetActive(false); int explosionID = _explosionPrefab.GetExplosionID(); GameObject explosion = OnGetExplosion?.Invoke(explosionID); explosion.transform.position = transform.position; explosion.SetActive(true); gameObject.SetActive(false); } if (other.tag == "Omni Shot") { OnScored?.Invoke(_scoreValue); int explosionID = _explosionPrefab.GetExplosionID(); GameObject explosion = OnGetExplosion?.Invoke(explosionID); explosion.transform.position = transform.position; explosion.SetActive(true); gameObject.SetActive(false); } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Omni Shot") { if (_isShieldActive == true) { _currentShieldStrength--; if (_currentShieldStrength > 0) { ChangeShield(_currentShieldStrength); return; } _isShieldActive = false; _shieldVisual.SetActive(false); return; } if (_player.gameObject.activeInHierarchy == true) { OnScored?.Invoke(_scoreValue); } if (_isDead == false) { PlayClip(_explosionClip); _isDead = true; } _anim.SetTrigger("Destroyed"); _speed = 0; gameObject.GetComponent <Collider2D>().enabled = false; StartCoroutine(DisableRoutine()); } if (other.tag == "Laser") { other.gameObject.SetActive(false); if (_isShieldActive == true) { _currentShieldStrength--; if (_currentShieldStrength > 0) { ChangeShield(_currentShieldStrength); return; } _isShieldActive = false; _shieldVisual.SetActive(false); return; } if (_player.gameObject.activeInHierarchy == true) { OnScored?.Invoke(_scoreValue); } if (_isDead == false) { PlayClip(_explosionClip); _isDead = true; } _anim.SetTrigger("Destroyed"); _speed = 0; gameObject.GetComponent <Collider2D>().enabled = false; StartCoroutine(DisableRoutine()); } if (other.tag == "Player") { if (_player.gameObject.activeInHierarchy == true) { OnDamagePlayer?.Invoke(-_ramDamage); } if (_isShieldActive == true) { _currentShieldStrength--; if (_currentShieldStrength > 0) { ChangeShield(_currentShieldStrength); return; } _isShieldActive = false; _shieldVisual.SetActive(false); return; } if (_isDead == false) { PlayClip(_explosionClip); _isDead = true; } _anim.SetTrigger("Destroyed"); _speed = 0; gameObject.GetComponent <Collider2D>().enabled = false; StartCoroutine(DisableRoutine()); } }