Exemplo n.º 1
0
 protected override void Awake()
 {
     base.Awake();
     m_pathResult     = new CTilePathResult();
     m_brainComp      = gameObject.GetComponent <CBrainComp>();
     m_perceptionComp = gameObject.GetComponent <CAIPerceptionComp>();
 }
Exemplo n.º 2
0
        /// <summary>
        /// 请求移动
        /// </summary>
        public void RequestMove(CTilePathResult wayPoints, MoveType moveType)
        {
            m_mover.SetMoveType(moveType);
            m_wayPoints = wayPoints;
            m_result    = FinishPathResultType.Default;
            m_status    = PathFollowingStatus.Moving;

            m_pathStepIndex = wayPoints.StartIndex;
            m_currStep      = wayPoints.StartPos;
            GotoNode(m_pathStepIndex);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 外来原因中止移动
        /// </summary>
        public void AbortMove()
        {
            m_result = FinishPathResultType.Aborted;
            m_status = PathFollowingStatus.Idle;

            m_wayPoints = null;
            if (m_onPathFinishedCallBack != null)
            {
                m_onPathFinishedCallBack(FinishPathResultType.Aborted);
                m_onPathFinishedCallBack = null;
            }
        }
Exemplo n.º 4
0
        private void Finish()
        {
            m_status = PathFollowingStatus.Idle;
            m_result = FinishPathResultType.Success;
            //跟随到了终点, 我们就停止了跟随
            m_mover.Stop();
            m_onPathFinishedCallBack?.Invoke(m_result);

            var dest = StepDestinationForNow;

            m_spacial.SetLocalPosInXZ(StepDestinationForNow);
            //Debug.Log("Path Follow Finished! At " + m_spacial.localPosition);

            m_wayPoints = null;
        }
Exemplo n.º 5
0
 /// <summary>
 /// 请求移动, 然后回调. 回调是在结算完成时调用
 /// 比如失败, 打断都会回调
 /// </summary>
 /// <param name="wayPoints">基于col, row的路径列表</param>
 /// <param name="finishCallBack">完成的回调</param>
 public void RequestMove(CTilePathResult wayPoints, OnPathFinished finishCallBack)
 {
     m_onPathFinishedCallBack = finishCallBack;
     RequestMove(wayPoints, MoveType.Direct);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 跟随路径点行走
 /// </summary>
 /// <param name="wayPoints"></param>
 public virtual void MoveWithPath(CTilePathResult wayPoints)
 {
     m_pawn.Follower.RequestMove(wayPoints, MoveType.Direct);
 }
Exemplo n.º 7
0
 public virtual void MoveToLocation(CTilePathResult waypoints, CPawnPathFollowingComp.OnPathFinished onComplete = null)
 {
     CTileNavigationSystem.Instance.SimpleMoveToLocation(this, waypoints, onComplete);
 }
Exemplo n.º 8
0
 public void TurnOnPathFollow(CTilePathResult wayPoints, float weight)
 {
     m_flags           |= (int)(SteeringType.PathFollow);
     m_weightFollowPath = weight;
     m_pathFollower.RequestMove(wayPoints, MoveType.Direct);
 }