Esempio n. 1
0
 void InitAgent()
 {
     _navmeshAgent = GetComponent <NavMeshAgent>();
     if (_navmeshAgent == null)
     {
         _navmeshAgent         = gameObject.AddComponent <NavMeshAgent>();
         _navmeshAgent.enabled = false;
     }
     #if NODEMOVE
     if (navMove == null)
     {
         navMove = GetComponent <NavMove>();
         if (navMove == null)
         {
             navMove         = gameObject.AddComponent <NavMove>();
             navMove.enabled = false;
         }
     }
     #endif
     if (_astarSeeker == null)
     {
         _astarSeeker = GetComponent <Seeker>();
         if (_astarSeeker == null)
         {
             _astarSeeker = gameObject.AddComponent <Seeker>();
         }
         _astarSeeker.pathCallback += OnPathComplete;
     }
 }
Esempio n. 2
0
 public Plug(Unit unit) : base(unit)
 {
     mCtrlMove = new CtrlMove();
     UnityEngine.AI.NavMeshAgent agent = unit.GetComponent <UnityEngine.AI.NavMeshAgent> ();
     if (agent != null)
     {
         mNavMove        = new NavMove();
         mNavMove.mAgent = agent;
     }
 }