本文整理汇总了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);
}
}
示例2: Start
// Use this for initialization
void Start ()
{
navAgent = GetComponent<NavMeshAgent>();
navAgent.SetDestination(ball.position);
}
示例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));
}
示例4: Start
void Start()
{
agent = GetComponent<NavMeshAgent>();
PF = GetComponent<PathFind>();
PF.OVRDest = true;
agent.SetDestination(Points[0].position);
}
示例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();
}
}
示例6: OnEnable
// Use this for initialization
void OnEnable()
{
agent = GetComponent<NavMeshAgent> ();
hunting = false;
currentDestination = RandomNavSphere (transform.position, wanderRadius, -1);
agent.SetDestination (currentDestination);
}
示例7: Start
void Start()
{
GetComponent<Rigidbody>().freezeRotation = true;
agent = gameObject.GetComponent<NavMeshAgent>();
agent.updatePosition = false;
agent.SetDestination(GameManager.Instance.player.transform.position);
}
示例8: Change
void Change()
{
target = GameObject.FindGameObjectWithTag ("dead").transform;
nav = GetComponent <NavMeshAgent> ();
nav.SetDestination (target.position);
}
示例9: OnEnable
// Use this for initialization
void OnEnable()
{
agent = GetComponent<NavMeshAgent> ();
hunting = false;
currentDestination = Random.Range (0, 3);
agent.SetDestination (destinations[currentDestination].transform.position);
}
示例10: Awake
void Awake()
{
nexus = GameObject.FindGameObjectWithTag ("nexus").transform;
isRIP = false;
nav = GetComponent <NavMeshAgent> ();
nav.SetDestination (nexus.position);
}
示例11: Start
void Start()
{
agent = GetComponent<NavMeshAgent>();
currentNavpoint = 0;
agent.SetDestination(navpoints[currentNavpoint].transform.position);
necromancer = other.gameObject.tag = "Necromancer";
}
示例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);
}
示例13: Start
void Start()
{
rb = GetComponent <Rigidbody> ();
myAgent = GetComponent <NavMeshAgent> ();
baseLocal = GameObject.FindGameObjectWithTag ("Base").transform.position;
myAgent.SetDestination (baseLocal);
SetHealth ();
}
示例14: Start
// Use this for initialization
void Start()
{
_navMeshAgent = GetComponent<NavMeshAgent> ();
if (_location != null) {
_navMeshAgent.SetDestination (_location);
}
}
示例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);
}