当前位置: 首页>>代码示例>>C#>>正文


C# NavMeshAgent.Stop方法代码示例

本文整理汇总了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();
        }
    }
开发者ID:JallarGames,项目名称:Dragonchronicles,代码行数:26,代码来源:AI_follow.cs

示例2: StartVirtual

    protected override void StartVirtual()
    {
        base.StartVirtual ();

        m_Agent = GetComponent<NavMeshAgent>();
        m_Agent.Stop ();

        m_Attack = GetComponent<AttackState>();
    }
开发者ID:Meetic666,项目名称:TillDeathDoUsPart,代码行数:9,代码来源:FlyingState.cs

示例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();
 }
开发者ID:ralphlizard,项目名称:HotPatata,代码行数:11,代码来源:Human.cs

示例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;
    }
开发者ID:CG-F15-26-Rutgers,项目名称:UnityProjects,代码行数:12,代码来源:BasicAgentScript.cs

示例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);
	}
开发者ID:DanielParra159,项目名称:GGJ2016,代码行数:19,代码来源:Enemy.cs

示例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;
		}

	}
开发者ID:deiner582,项目名称:simulation_police_and_thiefs,代码行数:39,代码来源:recorrerWayPoints.cs

示例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);
    }
开发者ID:MaDumont,项目名称:LesVoyeurs,代码行数:18,代码来源:GirlScript.cs

示例8: OnEnter

		public override void OnEnter ()
		{
			agent = ownerDefault.GetComponent<UnityEngine.NavMeshAgent> ();
			agent.Stop ();
			Finish ();
		}
开发者ID:NusantaraBeta,项目名称:BrawlerRumble,代码行数:6,代码来源:Stop.cs


注:本文中的UnityEngine.NavMeshAgent.Stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。