private void Update() { if (_stacksCount <= 0) { _damageTimer = 0; return; } if (_deapplyTimer > 0) { _deapplyTimer -= Time.deltaTime; if (_deapplyTimer <= 0) { Deapply(); _deapplyTimer = IntervalToDeapply; } } if (_damageTimer > 0) { _damageTimer -= Time.deltaTime; if (_damageTimer <= 0) { _entityHealth.ApplyDamage(_stacksCount * DAMAGE_AMOUNT); _damageTimer = DAMAGE_INTERVAL; } } }
private void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == "Factory") { EntityHealth factoryHealth = collider.GetComponent <EntityHealth>(); if (factoryHealth != null) { AudioSource.PlayClipAtPoint(AttackFactoryClip, Camera.main.transform.position); factoryHealth.ApplyDamage(DamageToFactory); Destroy(this.gameObject); } } }
private void OnTriggerEnter2D(Collider2D collider) { if (collider.gameObject == _owner || collider.tag == _teamTag) { return; } EntityHealth targetHealth = collider.GetComponent <EntityHealth>(); if (targetHealth != null) { targetHealth.ApplyDamage(Damage); HandleAttackType(collider.gameObject); } }