using UnityEngine;
using System.Collections;

public class rock_logic : MonoBehaviour {


	private global_variables variable_script;
	private GameObject gameManager;

	public GameObject dust_system;

	// Use this for initialization
	void Start () {

		gameManager = GameObject.FindGameObjectWithTag ("GameController").gameObject;
		variable_script = gameManager.GetComponent<global_variables> ();
	
		rigidbody2D.AddForce (variable_script.projection, ForceMode2D.Impulse);

	}
	
	// Update is called once per frame
	void Update () {


	}

	void OnCollisionEnter2D(Collision2D collision){


		GameObject dust_particle;

		dust_particle=Instantiate (dust_system,new Vector3(transform.position.x, (transform.position.y-(float)0.1),0),Quaternion.identity) as GameObject;

		Invoke ("ResetRockValue", (float)0.5);

		Destroy (gameObject,(float)0.5);

	}

	void ResetRockValue(){
				variable_script.rockFire = false;
	
		}
}
