#pragma strict

private var agent : NavMeshAgent;	//NavMeshAgent^̕ϐagent

function Start() {
	agent = GetComponent(NavMeshAgent);	//NavMeshAgentR|[lgQƂagentɐݒ肵܂
}

function Update() {
	if(Input.GetMouseButtonDown(0)) {
		var screenRay : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);	//J}EXŃNbNƂRay΂
		var hit : RaycastHit;
		if(Physics.Raycast(screenRay, hit))	//RayƂ𔻒
		{
			agent.SetDestination(hit.point);	//RayqbgʒuɈړ
		}
	}
}