示例#1
0
 private void CheckUpdateOffMeshLinkPosition()
 {
     m_linkposition = NavMeshAgentComponent.GetOffMeshLinkPosition();
     if (m_linkposition != NavMeshHelpers.OffMeshLinkPosition.Off)
     {
         OffMeshLinkUpdate(m_linkposition);
     }
 }
示例#2
0
        public void MoveToClosestEdge(bool fullspeed = true)
        {
            NavMeshHit hit;

            NavMeshAgentComponent.FindClosestEdge(out hit);
            BotComponent.UnFocus();
            BotComponent.FocusOnPosition(hit.position);
            MoveTowardsPosition(fullspeed);
            MoveToPosition(StopMovementConditions.WITHIN_PERSONAL_SPACE, fullspeed);
        }
        /// <summary>
        /// Land on a surface
        /// </summary>
        /// <param name="onNavMesh">Surface must be NavMesh</param>
        /// <param name="freefall ">Just fall down instead of gently landing</param>
        /// <returns>
        /// Wether or not the function was successful
        /// </returns>
        public bool Land(bool onNavMesh = true, bool freefall = false)
        {
            if (CurrentFlyableState != FStatesFlyable.Flying || (onNavMesh && !NavMeshAgentComponent.IsAboveNavMeshSurface()))
            {
                return(false);
            }
            _freefall = freefall;
            FSMFlyable.ChangeState(FStatesFlyable.Landing);

            return(true);
        }
        private void MoveTo(Vector3 destination, float speed, float angularSpeed)
        {
            NavMeshAgentComponent.speed        = speed;
            NavMeshAgentComponent.angularSpeed = angularSpeed;
            NavMeshAgentComponent.SetDestination(destination);

            /*
             * NavMeshAgentComponent.stoppingDistance = 0f;
             * switch (BotLocomotiveComponent.StopMovementCondition)
             * {
             *  case BotLocomotive.StopMovementConditions.WITHIN_INTERACTION_DISTANCE:
             *      NavMeshAgentComponent.stoppingDistance = BotLocomotiveComponent.SqrInteractionMagnitude * .75f;
             *      break;
             *  case BotLocomotive.StopMovementConditions.WITHIN_PERSONAL_SPACE:
             *      NavMeshAgentComponent.stoppingDistance = BotLocomotiveComponent.SqrPersonalSpaceMagnitude * .75f;
             *      break;
             * }
             */
            NavMeshAgentComponent.isStopped = false;
        }
 public bool IsAboveNavMeshSurface(out Vector3 navPosition)
 {
     return(NavMeshAgentComponent.IsAboveNavMeshSurface(out navPosition));
 }
 public bool IsAboveNavMeshSurface()
 {
     return(NavMeshAgentComponent.IsAboveNavMeshSurface());
 }