GrenadeScript.cs Troubles

I have a script and when I “throw” the grenade I want all enemies in a certain radius to lose health. how would I do this?

Here is my script:

using UnityEngine;
using System.Collections;

public class Grenade : MonoBehaviour 
{
	public bool isRadius1;
	public bool isRadius2;
	public Collider radius1;
	public Collider radius2;
	public int damage;
	public KeyCode throwKeycode;
	public Rigidbody grenadeObject;
	public Transform spawnPosition;
	public float throwSpeed = 0f;
	public float timer = 0f;

	void Update ()
	{
		if(Input.GetKeyDown(throwKeycode))
		{
			StartCoroutine("ThrowGrenade");
		}
	}

	IEnumerator ThrowGrenade ()
	{
		Rigidbody grenade = Instantiate (grenadeObject, spawnPosition.position, spawnPosition.rotation)as Rigidbody;
		grenade.AddForce (transform.position * throwSpeed);
		yield return new WaitForSeconds(timer);
		DamageEnemies (radius1);
	}

	void DamageEnemies (Collider col)
	{
		
	}
}

Thanks!

Hi,

I would simply use the OverlapSphere function.

Have a look here !

In my opinion that is the easiest way to check if an enemy was close to the grenade.

code_warrior