using UnityEngine;
using System.Collections;

public class Explosion : MonoBehaviour 
{
	// Use this for initialization
	void Start () 
    {
	
	}
	
	// Update is called once per frame
	void Update () 
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            Collider[] colliders = Physics.OverlapSphere(this.transform.position, 5f);
            for (int i = 0; i < colliders.Length; i++)
            {
                if (colliders[i].gameObject.GetComponent<Rigidbody>() != null)
                {
                    Debug.Log("HIT");
                    colliders[i].gameObject.GetComponent<Rigidbody>().AddExplosionForce(1000f, this.transform.position, 5f);
                }
            }
        }
	}
}
