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


C# NavMeshAgent.SetDestination方法代码示例

本文整理汇总了C#中UnityEngine.NavMeshAgent.SetDestination方法的典型用法代码示例。如果您正苦于以下问题:C# NavMeshAgent.SetDestination方法的具体用法?C# NavMeshAgent.SetDestination怎么用?C# NavMeshAgent.SetDestination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.NavMeshAgent的用法示例。


在下文中一共展示了NavMeshAgent.SetDestination方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnEnable

 // Use this for initialization
 void OnEnable()
 {
     agent = GetComponent<NavMeshAgent> ();
     hunting = false;
     huntTimer = 0;
     if (Random.value < 0.5f) {
         currentDestination = Random.Range (0, destinations.Length - 1);
         agent.SetDestination (destinations [currentDestination].transform.position);
     } else {
         hunting = true;
         agent.SetDestination (targetPlayer.transform.position);
         currentDestination = Random.Range (0, destinations.Length - 1);
     }
 }
开发者ID:pwestrich,项目名称:csc_4903_p2,代码行数:15,代码来源:Clyde.cs

示例2: Start

	// Use this for initialization
	void Start ()
    {
        navAgent = GetComponent<NavMeshAgent>();

        navAgent.SetDestination(ball.position);

	}
开发者ID:s4mmc,项目名称:BallGameProto,代码行数:8,代码来源:BasicAI.cs

示例3: Start

    // Use this for initialization
    void Start()
    {
        m_Trans = transform;
        m_Agent = m_Trans.GetComponent<NavMeshAgent>();

        m_Agent.SetDestination(new Vector3(0, 0, 0));
    }
开发者ID:natural20s,项目名称:ProjectAccountingSoftware,代码行数:8,代码来源:NavMeshTest.cs

示例4: Start

 void Start()
 {
     agent = GetComponent<NavMeshAgent>();
     PF = GetComponent<PathFind>();
     PF.OVRDest = true;
     agent.SetDestination(Points[0].position);
 }
开发者ID:Nortrix0,项目名称:Beyond-Equilibrium,代码行数:7,代码来源:PathFind_Points.cs

示例5: 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

示例6: OnEnable

 // Use this for initialization
 void OnEnable()
 {
     agent = GetComponent<NavMeshAgent> ();
     hunting = false;
     currentDestination = RandomNavSphere (transform.position, wanderRadius, -1);
     agent.SetDestination (currentDestination);
 }
开发者ID:pwestrich,项目名称:csc_4903_p2,代码行数:8,代码来源:Blinky.cs

示例7: Start

 void Start()
 {
     GetComponent<Rigidbody>().freezeRotation = true;
     agent = gameObject.GetComponent<NavMeshAgent>();
     agent.updatePosition = false;
     agent.SetDestination(GameManager.Instance.player.transform.position);
 }
开发者ID:deryckh,项目名称:RedneckGamesStampede,代码行数:7,代码来源:DeerMotor.cs

示例8: Change

	void Change()
	{
		target = GameObject.FindGameObjectWithTag ("dead").transform;
		
		nav = GetComponent <NavMeshAgent> ();
		nav.SetDestination (target.position);
	}
开发者ID:guangxij,项目名称:npc,代码行数:7,代码来源:navigate.cs

示例9: OnEnable

 // Use this for initialization
 void OnEnable()
 {
     agent = GetComponent<NavMeshAgent> ();
     hunting = false;
     currentDestination = Random.Range (0, 3);
     agent.SetDestination (destinations[currentDestination].transform.position);
 }
开发者ID:pwestrich,项目名称:csc_4903_p2,代码行数:8,代码来源:Inky.cs

示例10: Awake

 void Awake()
 {
     nexus = GameObject.FindGameObjectWithTag ("nexus").transform;
         isRIP = false;
         nav = GetComponent <NavMeshAgent> ();
         nav.SetDestination (nexus.position);
 }
开发者ID:selu285-2015,项目名称:285_02_FA15G2,代码行数:7,代码来源:Navigation.cs

示例11: Start

 void Start()
 {
     agent = GetComponent<NavMeshAgent>();
     currentNavpoint = 0;
     agent.SetDestination(navpoints[currentNavpoint].transform.position);
     necromancer = other.gameObject.tag = "Necromancer";
 }
开发者ID:Iciraus,项目名称:Heroes-Path,代码行数:7,代码来源:BossAct3.cs

示例12: Start

	void Start(){
		m_transform = this.transform;
		m_ani = this.GetComponent<Animator> ();
		m_player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
		m_agent = GetComponent<NavMeshAgent> ();
		//设置寻路目标
		m_agent.SetDestination (m_player.transform.position);
	}
开发者ID:Andy1994,项目名称:Unity,代码行数:8,代码来源:Enemy.cs

示例13: Start

 void Start()
 {
     rb = GetComponent <Rigidbody> ();
     myAgent = GetComponent <NavMeshAgent> ();
     baseLocal = GameObject.FindGameObjectWithTag ("Base").transform.position;
     myAgent.SetDestination (baseLocal);
     SetHealth ();
 }
开发者ID:RarCeth,项目名称:SystemShutdown,代码行数:8,代码来源:EnemyBasic.cs

示例14: Start

    // Use this for initialization
    void Start()
    {
        _navMeshAgent = GetComponent<NavMeshAgent> ();

        if (_location != null) {
            _navMeshAgent.SetDestination (_location);
        }
    }
开发者ID:IAmEska,项目名称:HexaTower,代码行数:9,代码来源:CharacterNavigation.cs

示例15: Awake

	public float Time = 3f;            // How long between each spawn.
	
	
	
	
	void Awake ()
	{
		// Set up the references.
		target = GameObject.FindGameObjectWithTag ("building3").transform;
		
		nav = GetComponent <NavMeshAgent> ();
		nav.SetDestination (target.position);
	}
开发者ID:guangxij,项目名称:npc,代码行数:13,代码来源:navigate.cs


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