Example #1
0
        void AddLink()
        {
#if UNITY_EDITOR
            if (m_LinkInstance.valid)
            {
                Debug.LogError("Link is already added: " + this);
                return;
            }
#endif

            var link = new NavMeshLinkData();
            link.startPosition = m_StartPoint;
            link.endPosition   = m_EndPoint;
            link.width         = m_Width;
            link.costModifier  = m_CostModifier;
            link.bidirectional = m_Bidirectional;
            link.area          = m_Area;
            link.agentTypeID   = m_AgentTypeID;
            m_LinkInstance     = NavMesh.AddLink(link, transform.position, transform.rotation);
            if (m_LinkInstance.valid)
            {
                m_LinkInstance.owner = this;
            }

            m_LastPosition = transform.position;
            m_LastRotation = transform.rotation;
        }
        public static NavMeshLinkInstance AddLink(NavMeshLinkData link, Vector3 position, Quaternion rotation)
        {
            var handle = new NavMeshLinkInstance();

            handle.id = AddLinkInternal(link, position, rotation);
            return(handle);
        }
Example #3
0
        void AddLink()
        {
#if UNITY_EDITOR
            if (_mLinkInstance.valid)
            {
                Debug.LogError($"Link is already added: {this}");
                return;
            }
#endif

            var link = new NavMeshLinkData();
            link.startPosition = mStartPoint;
            link.endPosition   = mEndPoint;
            link.width         = mWidth;
            link.costModifier  = mCostModifier;
            link.bidirectional = mBidirectional;
            link.area          = mArea;
            link.agentTypeID   = mAgentTypeId;
            _mLinkInstance     = NavMesh.AddLink(link, transform.position, transform.rotation);
            if (_mLinkInstance.valid)
            {
                _mLinkInstance.owner = this;
            }

            _mLastPosition = transform.position;
            _mLastRotation = transform.rotation;
        }
        public static NavMeshLinkInstance AddLink(NavMeshLinkData link)
        {
            var handle = new NavMeshLinkInstance();

            handle.id = AddLinkInternal(link, Vector3.zero, Quaternion.identity);
            return(handle);
        }
 static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.AI.NavMeshLinkInstance o;
         o = new UnityEngine.AI.NavMeshLinkInstance();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Example #6
0
        public static NavMeshLinkInstance AddLink(NavMeshLinkData link, Vector3 position, Quaternion rotation)
        {
            NavMeshLinkInstance result = default(NavMeshLinkInstance);

            result.id = AddLinkInternal(link, position, rotation);
            return(result);
        }
Example #7
0
        public static NavMeshLinkInstance AddLink(NavMeshLinkData link)
        {
            NavMeshLinkInstance result = default(NavMeshLinkInstance);

            result.id = AddLinkInternal(link, Vector3.zero, Quaternion.identity);
            return(result);
        }
Example #8
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.AI.NavMeshLinkInstance o;
         o = new UnityEngine.AI.NavMeshLinkInstance();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #9
0
        private void AddLink()
        {
            NavMeshLinkData navMeshLinkData = (NavMeshLinkData)null;

            ((NavMeshLinkData) ref navMeshLinkData).set_startPosition(this.m_StartPoint);
            ((NavMeshLinkData) ref navMeshLinkData).set_endPosition(this.m_EndPoint);
            ((NavMeshLinkData) ref navMeshLinkData).set_width(this.m_Width);
            ((NavMeshLinkData) ref navMeshLinkData).set_costModifier((float)this.m_CostModifier);
            ((NavMeshLinkData) ref navMeshLinkData).set_bidirectional(this.m_Bidirectional);
            ((NavMeshLinkData) ref navMeshLinkData).set_area(this.m_Area);
            ((NavMeshLinkData) ref navMeshLinkData).set_agentTypeID(this.m_AgentTypeID);
            this.m_LinkInstance = NavMesh.AddLink(navMeshLinkData, ((Component)this).get_transform().get_position(), ((Component)this).get_transform().get_rotation());
            if (((NavMeshLinkInstance) ref this.m_LinkInstance).get_valid())
            {
                ((NavMeshLinkInstance) ref this.m_LinkInstance).set_owner((Object)this);
            }
            this.m_LastPosition = ((Component)this).get_transform().get_position();
            this.m_LastRotation = ((Component)this).get_transform().get_rotation();
        }
Example #10
0
 public static void RemoveLink(NavMeshLinkInstance handle)
 {
     NavMesh.RemoveLinkInternal(handle.id);
 }