當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。