private void OnTriggerExit2D(Collider2D other) { if (other.gameObject.CompareTag(Statics.Tags.PLAYER_OUTSIDE)) { _shipHealth = null; } }
private void OnCollisionEnter2D(Collision2D collision) { DamageShip damageShip = collision.transform.GetComponent <DamageShip>(); if (damageShip != null && _canAttack) { damageShip.Hit(_damage); StartCoroutine(Wait()); } }
private void OnCollisionEnter2D(Collision2D collision) { DamageShip shipScript = collision.transform.GetComponent <DamageShip>(); if (shipScript != null && _waitTimer.Expired()) { _waitTimer.Reset(); shipScript.Hit(_damage); } }
private void OnTriggerEnter2D(Collider2D other) { DamageShip damageShip = other.GetComponent <DamageShip>(); if (damageShip != null) { damageShip.RecoverDamage(_recoverDamageAmout); Destroy(gameObject); } }
void Start() { _damageShipScript = GameManager.ShipObject.GetComponent <DamageShip>(); _lightShipScript = GameManager.ShipObject.GetComponent <LightShip>(); _moveShipScript = GameManager.ShipObject.GetComponent <MoveShip>(); _damageShipScript.ShipTakeDamageEvent += OnHealthChange; _lightShipScript.ShipUsedFlareEvent += OnFlare; _moveShipScript.ShipSoundEvent += OnNoiseChange; _originalHealthBarColor = _healthBarImage.color; }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag(Statics.Tags.PLAYER_OUTSIDE)) { if (_soundPlayer != null) { _soundPlayer.Play(); } _shipHealth = other.gameObject.GetComponent <DamageShip>(); } }