Exemple #1
0
        //吟唱阶段,自动转向目标
        void AutoLookatTarget()
        {
            ActorObj aimActorObj = m_actor.GetAttackObj();

            if (aimActorObj == null)
            {
                LogMgr.UnityLog("AutoLookatTarget() no target");
                return;
            }

            m_actor.FaceTo(aimActorObj.thisGameObject.transform.position);
        }
Exemple #2
0
        public behaviac.EBTStatus PlayerAutoMove()
        {
            if (!CoreEntry.GameStart || (CoreEntry.IsMobaGamePlay()))
            {
                return(behaviac.EBTStatus.BT_FAILURE);
            }

            //if (CoreEntry.gGameMgr.AutoFight)
            //{
            //    if (CoreEntry.gActorMgr.MainPlayer.m_bUseAI == false)
            //    {
            //        return behaviac.EBTStatus.BT_FAILURE;
            //    }
            //}


            ActorObj playerObj = m_actor;

            float distance = 0.0f;

            m_AttackObj = m_actor.GetAttackObj();
            if (m_AttackObj)
            {
                distance = Vector3.Distance(m_transform.position, m_AttackObj.transform.position);
                if (distance < fMonsterMinDist)
                {
                    playerObj.StopMove(true);

                    return(behaviac.EBTStatus.BT_SUCCESS);
                }
            }

            if (!ArenaMgr.Instance.IsArenaFight)
            {
                if (m_AttackObj)
                {
                    playerObj.StopMove(true);

                    nSkillIndex = 0;

                    return(behaviac.EBTStatus.BT_FAILURE);
                }
            }
            else
            {
                if (m_AttackObj)
                {
                    m_AutoNavPos = m_AttackObj.transform.position;
                }
            }

            //主角寻路超时设定,防止后面停止不动
            if (IsRunningTimeOut())
            {
                Debug.LogWarning("Main Player is running time out...");
                return(behaviac.EBTStatus.BT_FAILURE);
            }

            //目标没改变,且run状态,不处理
            if (m_movePos.Equals(m_AutoNavPos) && m_actor.curActorState == ACTOR_STATE.AS_RUN)
            {
                return(behaviac.EBTStatus.BT_RUNNING);
            }

            m_actor.FaceTo(m_AutoNavPos);

            if (m_actorObject.MoveToPos(m_AutoNavPos))
            {
                m_movePos = m_AutoNavPos;
            }

            return(behaviac.EBTStatus.BT_RUNNING);
        }