void Damage(Transform enemy) { EnemyAgent e = enemy.GetComponent <EnemyAgent>(); if (e != null) { e.TakeDamage(damage); } }
void Laser() { FindObjectOfType <AudioManager>().Play("laser"); enemyTarget.TakeDamage(damageOverTime * Time.deltaTime); enemyTarget.SlowSpeed(slowSpeed); if (!lineRenderer.enabled) { FindObjectOfType <AudioManager>().Stop("laser"); lineRenderer.enabled = true; particleImpactEffect.Play(); impactLight.enabled = true; } lineRenderer.SetPosition(0, firePoint.position); lineRenderer.SetPosition(1, target.position); Vector3 direction = firePoint.position - transform.position; particleImpactEffect.transform.position = target.position + direction.normalized * 0.5f; particleImpactEffect.transform.rotation = Quaternion.LookRotation(direction); }