private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { PlayerHealth playerHealth = other.GetComponent <PlayerHealth> (); if (playerHealth != null) { playerHealth.TakeDamage(damage); } KnockbackOnHit knockback = other.GetComponent <KnockbackOnHit> (); if (knockback != null) { knockback.knockbackFromRight = JVUtil.IsTargetOnTheLeft(other.transform, transform); } } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Enemy") { //Instantiate (enemyDeathEffect, other.transform.position, other.transform.rotation); //Destroy (other.gameObject); //ScoreManager.AddPoints (pointsForKill); other.GetComponent <Health> ().TakeDamage(damage); KnockbackOnHit knockback = other.GetComponent <KnockbackOnHit> (); if (knockback != null) { knockback.knockbackFromRight = JVUtil.IsTargetOnTheLeft(other.transform, transform); } } SelfDestroy(); }