using UnityEngine;
using System.Collections;

public class RouteMarker : MonoBehaviour {
	public RouteMarker[] markerlist_connect;

	private float search_distance;
	private RouteMarker search_next;
	// Use this for initialization
	void Start () {
		resetSearch ();
		JailerRouteManager.Instance.addMarker (this);
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	void OnDrawGizmos (){
		Gizmos.color = Color.yellow;
		Gizmos.DrawSphere(transform.position, 0.25f);
		int linevalue = 20;
		for (int i = 0; i < markerlist_connect.Length; i++) {
			Vector3 vec = markerlist_connect [i].gameObject.transform.position - transform.position;
			Gizmos.DrawLine (transform.position, transform.position + vec);
			float height = 0.5f;
			Gizmos.DrawLine (transform.position + vec * 0.1f + Vector3.up * height, transform.position + vec * 0.15f);
			Gizmos.DrawLine (transform.position + vec * 0.1f + Vector3.down * height, transform.position + vec * 0.15f);
			Gizmos.DrawLine (transform.position + vec * 0.1f + Vector3.up * height, transform.position + vec * 0.1f + Vector3.down * height);
		}
	} 

	public float getSearchDistance(){
		return search_distance;
	}
	public void setSeachDistance(float dist){
		search_distance = dist;
	}

	public RouteMarker getSearchNext(){
		return search_next;
	}
	public void setSearchNext(RouteMarker marker){
		search_next = marker;
	}

	public void resetSearch(){
		search_distance = Mathf.Infinity;
		search_next = null;
	}
}
