本文整理汇总了C#中UnityEngine.NavMeshAgent类的典型用法代码示例。如果您正苦于以下问题:C# NavMeshAgent类的具体用法?C# NavMeshAgent怎么用?C# NavMeshAgent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NavMeshAgent类属于UnityEngine命名空间,在下文中一共展示了NavMeshAgent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
//Vector3 oldpos;
//Vector3 newpos;
void Start()
{
player = GetComponent<NavMeshAgent>();
anim = player.GetComponent<Animator> ();
//oldpos = newpos = transform.position;
}
示例2: Start
void Start()
{
plyr = GameObject.FindGameObjectWithTag("Player");
agent = GetComponent<NavMeshAgent>();
enemySightSeal = this.GetComponent<EnemySight>();
readInPatrol(startingRoom);
}
示例3: Awake
public void Awake()
{
//Initialize components
nav = GetComponent<NavMeshAgent>();
player = GameObject.FindWithTag("Player").transform;
playerHealth = player.GetComponent<PlayerHealth>();
}
示例4: Start
void Start()
{
setWay(way);
agent = GetComponent<NavMeshAgent>();
curPathIndex = 0;
GoToNextPoint();
}
示例5: Awake
//
void Awake ()
{
player = GameObject.FindGameObjectWithTag ("Player").transform;
//playerHealth = player.GetComponent <PlayerHealth> ();
//enemyHealth = GetComponent <EnemyHealth> ();
nav = GetComponent <NavMeshAgent> ();
}
示例6: Start
// Use this for initialization
void Start()
{
CreatureAnimator = GetComponent<Animator>();
Player = GameObject.FindGameObjectWithTag("Player");
Agente = GetComponent<NavMeshAgent>();
StartCoroutine(attack());
}
示例7: Start
//////////////////////////////////////////////////////////////////////////////
// //
//Unity Functions //
// //
//////////////////////////////////////////////////////////////////////////////
void Start()
{
agent = GetComponent<NavMeshAgent>();
agent.speed *= Random.Range(1.2f, 0.8f);
SetDestination();
}
示例8: Awake
void Awake()
{
agent = GetComponent<NavMeshAgent>();
obstacle = GetComponent<NavMeshObstacle>();
m_Animation = GetComponentInChildren<Animation>();
enemyAttack = GetComponent<EnemyAttack>();
stats = GetComponent<UnitStats>();
m_AudioSource = GetComponent<AudioSource>();
baseAttackSpeedCache = timeBetweenAttacks;
switch (unitType)
{
case EnemyTypes.Minion:
selectedAction = "Punch";
break;
case EnemyTypes.Brute:
selectedAction = "Slam";
break;
case EnemyTypes.Evoker:
selectedAction = "Shoot";
break;
case EnemyTypes.Bob:
selectedAction = "Explode";
break;
default:
break;
}
}
示例9: Start
// Use this for initialization
//void Start () {
//}
void Start()
{
icon = PlayerUIMgr.instance.AddHunterIcon();
icon.GetComponent<BoundObject>().SetBoundTranform(this.transform);
//icon.onClick.AddListener(this.GetComponent<NvigationGame>().Select);
hunter_nav = this.GetComponent<NvigationGame>();
name_text = PlayerUIMgr.instance.AddText();
name_text.GetComponent<BoundObject>().SetBoundTranform(this.transform);
name_text.GetComponent<BoundObject>().SetGap(new Vector2(0,20));
hunter_name_ui = HunterListPanel.instance.AddHunterName("hunter1");
hunter_name_ui.hunter = this;
SetName("hunter1");
icon.GetComponent<HunterUI>().hunter = this;
floor_mask = 1 << 8 + 1 << 9 + 1 << 10;
my_agent = this.transform.parent.GetComponent<NavMeshAgent>();
//追跡フラッグをoff
target = null;
}
示例10: Start
// Use this for initialization
void Start()
{
destination = transform.position;
navMeshAgent = GetComponent<NavMeshAgent> ();
animator = GetComponent<Animator> ();
target = GameObject.FindGameObjectWithTag ("Player");
}
示例11: Change
void Change()
{
target = GameObject.FindGameObjectWithTag ("dead").transform;
nav = GetComponent <NavMeshAgent> ();
nav.SetDestination (target.position);
}
示例12: OnGameStart
protected override void OnGameStart(SceneScript scene)
{
agent = GetComponent<NavMeshAgent>();
detection = GetComponentInChildren<AIRangeDetection>();
detection.Load(this);
}
示例13: Start
void Start()
{
animator = GetComponent<Animator> ();
target = GameObject.Find ("Player").transform;
agent = GetComponent<NavMeshAgent>();
destination = agent.destination;
}
示例14: Start
// Use this for initialization
void Start()
{
meshub = GameObject.Find("MessageHub").GetComponent<MessageHub>();
navagent = this.gameObject.GetComponent<NavMeshAgent>();
fullhealth = health;
}
示例15: Reset
void Reset()
{
characterController = GetComponentInChildren<CharacterController>();
navMeshAgent = GetComponentInChildren<NavMeshAgent>();
joystickNavigationController = GetComponent<JoystickNavigationController>();
camera = GetComponentInChildren<Camera>().gameObject;
}