示例#1
0
        void DoSamplePath()
        {
            if (_agent == null)
            {
                return;
            }

            UnityEngine.AI.NavMeshHit _NavMeshHit;
            bool _reachedBeforeMaxDistance = _agent.SamplePathPosition(passableMask.Value, maxDistance.Value, out _NavMeshHit);

            reachedBeforeMaxDistance.Value = _reachedBeforeMaxDistance;

            position.Value = _NavMeshHit.position;
            normal.Value   = _NavMeshHit.normal;
            distance.Value = _NavMeshHit.distance;
            mask.Value     = _NavMeshHit.mask;
            hit.Value      = _NavMeshHit.hit;

            if (_reachedBeforeMaxDistance)
            {
                if (!FsmEvent.IsNullOrEmpty(reachedBeforeMaxDistanceEvent))
                {
                    Fsm.Event(reachedBeforeMaxDistanceEvent);
                }
            }
            else
            {
                if (!FsmEvent.IsNullOrEmpty(reachedAfterMaxDistanceEvent))
                {
                    Fsm.Event(reachedAfterMaxDistanceEvent);
                }
            }
        }