Esempio n. 1
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);
        }
Esempio n. 2
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;
            }
        }
Esempio n. 3
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;
        }
Esempio n. 4
0
        /// <summary>
        /// 请求移动, 并且立刻结束
        /// </summary>
        public void RequestMoveWithImmediateFinish(FinishPathResultType result)
        {
            //先强行停止之前的移动
            if (m_status != PathFollowingStatus.Idle && m_onPathFinishedCallBack != null)
            {
                m_onPathFinishedCallBack(FinishPathResultType.Aborted);
            }

            //接着通知完成移动, 并告知完成的结果
            if (m_onPathFinishedCallBack != null)
            {
                m_onPathFinishedCallBack(result);
            }

            m_result = result;
        }
Esempio n. 5
0
 /// <summary>
 /// 重置本组件的初始状态
 /// </summary>
 public void ResetFinishResult()
 {
     m_result = FinishPathResultType.Default;
     m_status = PathFollowingStatus.Idle;
 }