本文整理汇总了C#中UnityEngine.NavMeshAgent.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# NavMeshAgent.Stop方法的具体用法?C# NavMeshAgent.Stop怎么用?C# NavMeshAgent.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.NavMeshAgent
的用法示例。
在下文中一共展示了NavMeshAgent.Stop方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
void Update()
{
player = sCharactersManager.characters[0].gameObject;
agent = GetComponent<NavMeshAgent>();
if(!gameObject.GetComponent<Character>().isDead)
{
if(agent.isOnNavMesh)
{
agent.SetDestination(player.transform.position);
if(Vector3.Distance(player.transform.position,transform.position) > 1.5f)
{
agent.Resume();
}else{
agent.Stop();
}
}
if(Vector3.Distance(player.transform.position,transform.position) < 5)
{
Vector3 lookPos = new Vector3(player.transform.position.x, gameObject.transform.position.y, player.transform.position.z);
gameObject.transform.LookAt(lookPos);
}
}else{
agent.Stop();
}
}
示例2: StartVirtual
protected override void StartVirtual()
{
base.StartVirtual ();
m_Agent = GetComponent<NavMeshAgent>();
m_Agent.Stop ();
m_Attack = GetComponent<AttackState>();
}
示例3: Start
// Use this for initialization
void Start()
{
DontDestroyOnLoad (this);
startPos = transform.position;
startRot = transform.rotation;
anim = GetComponent<Animator> ();
agent = GetComponent<NavMeshAgent> ();
minDistance = agent.stoppingDistance;
agent.Stop();
}
示例4: Start
void Start()
{
agent = GetComponent<NavMeshAgent>();
agent.autoBraking = true;
agent.autoRepath = true;
agent.Stop();
target = agent.gameObject.transform.position; // First "target" should be its current position.
agent.SetDestination(target);
active = false;
}
示例5: Start
// Use this for initialization
void Start () {
myTransform = transform;
target = GameManager.instance.hero.transform;
agent = GetComponent<NavMeshAgent> ();
// Disparos
if (!isSeeker) {
shootsPool.Reset ();
agent.Stop ();
} else {
// agent.updatePosition = true;
agent.updateRotation = false;
}
life = gameObject.GetComponent<Life>();
life.registerOnDead(onDead);
life.registerOnDamage(onDamage);
}
示例6: OnTriggerStay
void OnTriggerStay (Collider objecto)
{
//si el ladron entro en el sphere collider
if(objecto.gameObject.tag=="ladron")
{
//obtiene el componente animator del Ladron
animator_ladron = objecto.GetComponent<Collider>().GetComponent<Animator>();
//obtiene el componente navmeshagent del ladron
agente_ladron = objecto.GetComponent<Collider>().GetComponent<NavMeshAgent>();
// Create a vector from the enemy to the player and store the angle between it and forward.
Vector3 direccion = objecto.transform.position - transform.position;
float angulo = Vector3.Angle(direccion,transform.forward);
// If the angle between forward and where the player is, is less than half the angle of view...
if(angulo < angulo_de_vision * 0.5f)
{
distancia = Vector3.Distance(transform.position, objecto.GetComponent<Collider>().transform.position);
agente.SetDestination(objecto.GetComponent<Collider>().transform.position);
animator.SetBool("correr",true);
if(distancia<=3 && atrapado == false){
contar_ladrones+=1;
l_ladrones.text=contar_ladrones.ToString();
animator_ladron.SetBool("morir",true);
objecto.gameObject.tag="muerto";
objecto.GetComponent<SphereCollider>().enabled=false;
agente_ladron.Stop();
agente_ladron.speed = 0;
}
}
} else{
animator.SetBool("correr",false);
atrapado=false;
}
}
示例7: Start
void Start()
{
GameManager.getInstance ().addGuardListener (this);
anim = GetComponent<Animator> ();
agent = GetComponent<NavMeshAgent>();
eyes = GetComponentInChildren<FOV2DEyes>();
visionCone = GetComponentInChildren<FOV2DVisionCone>();
currentState = State.IDLE;
// Disabling auto-braking allows for continuous movement
// between points (ie, the agent doesn't slow down as it
// approaches a destination point).
agent.autoBraking = false;
agent.Stop ();
// Set the agent to go to the currently selected destination.
agent.destination = point.position;
InvokeRepeating ("CheckVision", 0, 0.3f);
}
示例8: OnEnter
public override void OnEnter ()
{
agent = ownerDefault.GetComponent<UnityEngine.NavMeshAgent> ();
agent.Stop ();
Finish ();
}