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

スクリプト言語

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

NavMeshAgent.ActivateCurrentOffMeshLink

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 ActivateCurrentOffMeshLink(activated: bool): void;
public void ActivateCurrentOffMeshLink(bool activated);
public def ActivateCurrentOffMeshLink(activated as bool) as void

Parameters

activated リンクが有効かどうか

Description

現在の OffMeshLink オブジェクトを有効/無効にします

この関数によりエージェントが現在待機している位置の OffMeshLink を有効/無効にします。ゲーム世界で 新たに発見したエリアへアクセスできるようにする場合や エリアへの障害物の作成/破棄に役に立ちます。

	private var agent: NavMeshAgent;

	function Start () {
		agent = GetComponent.<NavMeshAgent>();
	}
	
	// Allow all agents to have access to an area once it has officially
	// been "discovered".
	function OpenDiscoveredArea(areasDiscovered: Hashtable) {
		if (agent.isOnOffMeshLink) {
			if (areasDiscovered.ContainsKey(agent.currentOffMeshLinkData.offMeshLink.name)) {
				agent.ActivateCurrentOffMeshLink(true);
			}	
		}
	}
using UnityEngine;
using System.Collections;

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

public class ExampleClass(MonoBehaviour):

	private agent as NavMeshAgent

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

	def OpenDiscoveredArea(areasDiscovered as Hashtable) as void:
		if agent.isOnOffMeshLink:
			if areasDiscovered.ContainsKey(agent.currentOffMeshLinkData.offMeshLink.name):
				agent.ActivateCurrentOffMeshLink(true)