當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。