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


C# UnityEngine.NavMeshAgent类代码示例

本文整理汇总了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;
    }
开发者ID:jsimoesjr,项目名称:Unity,代码行数:9,代码来源:PlayerControl.cs

示例2: Start

 void Start()
 {
     plyr = GameObject.FindGameObjectWithTag("Player");
     agent = GetComponent<NavMeshAgent>();
     enemySightSeal = this.GetComponent<EnemySight>();
     readInPatrol(startingRoom);
 }
开发者ID:justcollins,项目名称:HootLunMimia,代码行数:7,代码来源:EnemyPathing.cs

示例3: Awake

 public void Awake()
 {
     //Initialize components
     nav = GetComponent<NavMeshAgent>();
     player = GameObject.FindWithTag("Player").transform;
     playerHealth = player.GetComponent<PlayerHealth>();
 }
开发者ID:FERRERDEV,项目名称:MonstersAttack,代码行数:7,代码来源:EnemyController.cs

示例4: Start

 void Start()
 {
     setWay(way);
     agent = GetComponent<NavMeshAgent>();
     curPathIndex = 0;
     GoToNextPoint();
 }
开发者ID:emirg1989,项目名称:trabajos,代码行数:7,代码来源:WayPoints.cs

示例5: Awake

 //
 void Awake ()
 {
     player = GameObject.FindGameObjectWithTag ("Player").transform;
     //playerHealth = player.GetComponent <PlayerHealth> ();
     //enemyHealth = GetComponent <EnemyHealth> ();
     nav = GetComponent <NavMeshAgent> ();
 }
开发者ID:mikeias07,项目名称:Nightmare_ivo,代码行数:8,代码来源:EnemyMovement.cs

示例6: Start

 // Use this for initialization
 void Start()
 {
     CreatureAnimator = GetComponent<Animator>();
     Player = GameObject.FindGameObjectWithTag("Player");
     Agente = GetComponent<NavMeshAgent>();
     StartCoroutine(attack());
 }
开发者ID:RicardoJardines,项目名称:ProyectoFinal-The-Salvation-,代码行数:8,代码来源:CreatureController.cs

示例7: Start

        //////////////////////////////////////////////////////////////////////////////
        //                                                                          //
        //Unity Functions                                                           //
        //                                                                          //
        //////////////////////////////////////////////////////////////////////////////
        void Start()
        {
            agent = GetComponent<NavMeshAgent>();
            agent.speed *= Random.Range(1.2f, 0.8f);

            SetDestination();
        }
开发者ID:jackmawer,项目名称:animalvillage,代码行数:12,代码来源:CW_Demo_LittlePlanet_Horse.cs

示例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;
        }
    }
开发者ID:MaddJhin,项目名称:Holdout,代码行数:32,代码来源:EnemyUnitControl.cs

示例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;
       
        
    }
开发者ID:FairyHamaLab,项目名称:Desertion,代码行数:31,代码来源:Hunter.cs

示例10: Start

 // Use this for initialization
 void Start()
 {
     destination = transform.position;
     navMeshAgent = GetComponent<NavMeshAgent> ();
     animator = GetComponent<Animator> ();
     target = GameObject.FindGameObjectWithTag ("Player");
 }
开发者ID:jflorimo,项目名称:d08,代码行数:8,代码来源:Enemies.cs

示例11: Change

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

示例12: OnGameStart

    protected override void OnGameStart(SceneScript scene)
    {
        agent = GetComponent<NavMeshAgent>();

        detection = GetComponentInChildren<AIRangeDetection>();
        detection.Load(this);
    }
开发者ID:muit,项目名称:LudumDare33,代码行数:7,代码来源:CApple.cs

示例13: Start

 void Start()
 {
     animator = GetComponent<Animator> ();
     target = GameObject.Find ("Player").transform;
     agent = GetComponent<NavMeshAgent>();
     destination = agent.destination;
 }
开发者ID:UoN-GamesGroup,项目名称:Year2-GroupProject,代码行数:7,代码来源:InteriorMainMovement.cs

示例14: Start

    // Use this for initialization
    void Start()
    {
        meshub = GameObject.Find("MessageHub").GetComponent<MessageHub>();
        navagent = this.gameObject.GetComponent<NavMeshAgent>();

        fullhealth = health;
    }
开发者ID:SurvivalOfTheFittest,项目名称:Project-Immortui,代码行数:8,代码来源:AIScript.cs

示例15: Reset

 void Reset()
 {
     characterController = GetComponentInChildren<CharacterController>();
     navMeshAgent = GetComponentInChildren<NavMeshAgent>();
     joystickNavigationController = GetComponent<JoystickNavigationController>();
     camera = GetComponentInChildren<Camera>().gameObject;
 }
开发者ID:Foxshiver,项目名称:Projet_Immersia,代码行数:7,代码来源:NavigationManager.cs


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