using UnityEngine; using System.Collections;  public class DrawLineScript : MonoBehaviour { 	 	internal static Vector3 drawLineStartPosition; 	internal static Vector3 drawLineEndPositionFirst; 	internal static Vector3 drawLineEndPositionSecond; 	internal static Vector3 drawLineEndPositionThird; 	public GameObject lineRenderPosition; 	public GameObject lineRenderPosition2; 	 	public LineRenderer lineOne; 	public LineRenderer lineTwo; 	public LineRenderer lineThree; 	GameObject temp=null; 	GameObject temp1=null; 	GameObject temp2=null; 	GameObject temp3=null; 	GameObject temp4=null; 	GameObject temp5=null; 	Color c1=Color.white; 	Color c2=Color.white; 	Color d1=Color.red; 	Color d2=Color.red; 	 	void Start() 	{ 		 	} 	 	/// <summary> 	/// Draws the line one. 	/// </summary> 	 	internal void DrawLineOne() 	{ 		lineOne.renderer.enabled=true; 		if(temp!=null) 			Destroy(temp); 		if(temp1!=null) 			Destroy(temp1); 	 		temp= (GameObject)Instantiate (lineRenderPosition,new Vector3(drawLineEndPositionFirst.x,drawLineEndPositionFirst.y,0),Quaternion.identity); 		temp.rigidbody.AddForce(new Vector3(0,-1f,0f),ForceMode.Impulse); 		temp1= (GameObject)Instantiate (lineRenderPosition2,new Vector3(drawLineStartPosition.x,drawLineStartPosition.y,0),Quaternion.identity); 		temp1.rigidbody.AddForce(new Vector3(0,-1f,0f),ForceMode.Impulse); 		lineOne.SetPosition(0,temp1.transform.position); 		lineOne.SetPosition(1,temp.transform.position); 		 		 	} 	 	 	/// <summary> 	/// Draws the line two. 	/// </summary> 	internal void DrawLineTwo() 	{ 		lineTwo.renderer.enabled=true; 		if(temp2!=null) 			Destroy(temp2); 		if(temp3!=null) 			Destroy(temp3); 		 		temp2= (GameObject)Instantiate (lineRenderPosition2,new Vector3(drawLineStartPosition.x,drawLineStartPosition.y,0),Quaternion.identity); 		temp2.rigidbody.AddForce(new Vector3(0,-1f,0f),ForceMode.Impulse); 		temp3= (GameObject)Instantiate (lineRenderPosition,new Vector3(drawLineEndPositionSecond.x,drawLineEndPositionSecond.y,0),Quaternion.identity); 		temp3.rigidbody.AddForce(new Vector3(0,-1f,0f),ForceMode.Impulse); 		 		lineTwo.SetPosition(0,temp2.transform.position); 		lineTwo.SetPosition(1,temp3.transform.position); 	} 	 	 	 	/// <summary> 	/// Draws the line three. 	/// </summary> 	internal void DrawLineThree() 	{ 		lineThree.renderer.enabled=true; 		 		if(temp4!=null) 			Destroy(temp4); 		if(temp5!=null) 			Destroy(temp5); 		temp4= (GameObject)Instantiate (lineRenderPosition2,new Vector3(drawLineStartPosition.x,drawLineStartPosition.y,0),Quaternion.identity); 		temp4.rigidbody.AddForce(new Vector3(0,-1f,0f),ForceMode.Impulse); 		temp5= (GameObject)Instantiate (lineRenderPosition,new Vector3(drawLineEndPositionThird.x,drawLineEndPositionThird.y,0),Quaternion.identity); 		temp5.rigidbody.AddForce(new Vector3(0,-1f,0f),ForceMode.Impulse); 		 		lineThree.SetPosition(0,temp4.transform.position); 		lineThree.SetPosition(1,temp5.transform.position); 				 	} 	 	 	 	 	/// <summary> 	/// Chainfall this instance. 	/// </summary> 	internal void Chainfall() 	{ 		 		print ("draw line function is called"); 		InvokeRepeating("Chainfallfirst",.5f,.1f);  	} 	 	 	/// <summary> 	/// Chainfallfirst this instance. 	/// </summary> 	void Chainfallfirst() 	{ 		if(temp1!=null && temp!=null) 		{ 		lineOne.SetPosition(0,temp1.transform.position); 		lineOne.SetPosition(1,temp.transform.position);	 		} 	} 	 	 	/// <summary> 	/// Chainfall2 this instance. 	/// </summary> 	internal void Chainfall2() 	{ 	 		InvokeRepeating("Chainfallsecond",.5f,.1f);	 	} 	 	 	/// <summary> 	/// Chainfallsecond this instance. 	/// </summary> 	void Chainfallsecond() 	{ 		if(temp2!=null && temp3!=null) 		{ 			lineTwo.SetPosition(0,temp2.transform.position); 			lineTwo.SetPosition(1,temp3.transform.position); 		} 	} 	 	 	/// <summary> 	/// Chainfall3 this instance. 	/// </summary> 	internal void Chainfall3() 	{ 	 		InvokeRepeating("Chainfallthird",.5f,.1f);	 			 	} 	 	 	/// <summary> 	/// Chainfallthird this instance. 	/// </summary> 	void Chainfallthird() 	{ 		if(temp4!=null && temp5!=null) 		{ 			lineThree.SetPosition(0,temp4.transform.position); 			lineThree.SetPosition(1,temp5.transform.position); 		} 	} 	 	 	 	/// <summary> 	/// Changes the color. 	/// </summary> 	internal void ChangeColor() 	{ 		LineRenderer lineRenderer3=lineThree.GetComponent<LineRenderer>(); 		LineRenderer lineRenderer2=lineTwo.GetComponent<LineRenderer>(); 		LineRenderer lineRenderer=lineOne.GetComponent<LineRenderer>(); 		lineRenderer.material = new Material(Shader.Find("Particles/Additive")); 		lineRenderer.SetColors(c1, c2);	 		lineRenderer2.material = new Material(Shader.Find("Particles/Additive")); 		lineRenderer2.SetColors(c1, c2); 		lineRenderer3.material = new Material(Shader.Find("Particles/Additive")); 		lineRenderer3.SetColors(c1, c2); 	} 	 	 	 	/// <summary> 	/// Resets the color. 	/// </summary> 	internal void ResetColor() 	{ 		LineRenderer lineRenderer3=lineThree.GetComponent<LineRenderer>(); 		LineRenderer lineRenderer2=lineTwo.GetComponent<LineRenderer>(); 		LineRenderer lineRenderer=lineOne.GetComponent<LineRenderer>(); 		lineRenderer.material = new Material(Shader.Find("Particles/Additive")); 		lineRenderer.SetColors(d1, d2);	 		lineRenderer2.material = new Material(Shader.Find("Particles/Additive")); 		lineRenderer2.SetColors(d1, d2); 		lineRenderer3.material = new Material(Shader.Find("Particles/Additive")); 		lineRenderer3.SetColors(d1, d2); 	} 	 	 	 	 	/// <summary> 	/// Determines whether this instance cancel chain fall. 	/// </summary> 	/// <returns> 	/// <c>true</c> if this instance cancel chain fall; otherwise, <c>false</c>. 	/// </returns> 	internal void CancelChainFall() 	{ 		CancelInvoke("Chainfallfirst"); 		CancelInvoke("Chainfallsecond"); 		CancelInvoke("Chainfallthird"); 	} 	 	/// <summary> 	/// Draws the line render false. 	/// </summary> 	internal void DrawLineRenderFalse() 	{ 		lineOne.renderer.enabled=false; 		lineTwo.renderer.enabled=false; 		lineThree.renderer.enabled=false; 	} }