言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

NavMeshAgent.CompleteOffMeshLink

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public function CompleteOffMeshLink(): void;
public void CompleteOffMeshLink();
public def CompleteOffMeshLink() as void

Description

現在のOffMeshLinkに従います

When the autoTraverseOffMeshLink property is switched off an agent will pause at an off-mesh link until this function is called to let it pass. This can be used to allow characters access selectively (eg, to simulate openable doors or obstacles that only certain characters can pass, etc).

	private var agent: NavMeshAgent;

	function Start () {
		agent = GetComponent.<NavMeshAgent>();
	}
	
	// Let an agent cross the off-mesh link if he has
	// the right door key.
	function CheckForDoorKey(doorKeys: Hashtable) {
		if (agent.isOnOffMeshLink) {
			if (doorKeys.ContainsKey(agent.currentOffMeshLinkData.offMeshLink.name)) {
				agent.CompleteOffMeshLink();
			}	
		}
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    private NavMeshAgent agent;
    void Start() {
        agent = GetComponent<NavMeshAgent>();
    }
    void CheckForDoorKey(Hashtable doorKeys) {
        if (agent.isOnOffMeshLink)
            if (doorKeys.ContainsKey(agent.currentOffMeshLinkData.offMeshLink.name))
                agent.CompleteOffMeshLink();
            
        
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	private agent as NavMeshAgent

	def Start() as void:
		agent = GetComponent[of NavMeshAgent]()

	def CheckForDoorKey(doorKeys as Hashtable) as void:
		if agent.isOnOffMeshLink:
			if doorKeys.ContainsKey(agent.currentOffMeshLinkData.offMeshLink.name):
				agent.CompleteOffMeshLink()