Esempio n. 1
0
    public void RliveCityOK()
    {
        //如果角色Dead&&在幅本中.打开失败界面
        Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

        if (_mainPlayer == null)
        {
            return;
        }
        if (_mainPlayer.IsDie() && GameManager.gameManager.ActiveScene.IsStoryCopyScene())
        {
            UIManager.CloseUI(UIInfo.Relive);
            UIManager.ShowUI(UIInfo.StoryCopySceneResultRoot, OnShowStoryCopySceneResultWindow);
            return;
        }
        if (_mainPlayer.IsDie() && GameManager.gameManager.ActiveScene.IsCopyScene())
        {
            UIManager.CloseUI(UIInfo.Relive);
            UIManager.ShowUI(UIInfo.FailRoot, OnShowFailRootWindow);
        }
        else
        {
            CG_ASK_RELIVE packet = (CG_ASK_RELIVE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ASK_RELIVE);
            packet.SetType((int)Games.GlobeDefine.GameDefine_Globe.RELIVE_TYPE.RELIVE_CITY);
            packet.SendPacket();
        }
    }
Esempio n. 2
0
    public void OnPowerUp()
    {
        // 显示体检界面
        if (GameManager.gameManager.ActiveScene.IsCopyScene() == false)         //不是副本
        {
            return;
        }
        else
        {
            PVPData.PowerUpAutoShow = true;
            //如果玩家已经死亡,先向服务器发送一个复活消息。
            Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

            if (_mainPlayer != null && _mainPlayer.IsDie())
            {
                SendPlayerReliveMsg();
            }
        }

        if (m_bIsNeedSendLevelCopySceneMsg)
        {
            // 离开副本
            SendLeaveCopySceneMsg();
        }

        // 关闭失败界面
        //gameObject.SetActive(false);
    }
Esempio n. 3
0
    public void OnQuitCopyScene()
    {
        //如果玩家已经死亡,先向服务器发送一个复活消息。
        Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

        if (_mainPlayer != null && _mainPlayer.IsDie())
        {
            SendPlayerReliveMsg();
        }
        if (m_bIsNeedSendLevelCopySceneMsg)
        {
            // 离开副本
            SendLeaveCopySceneMsg();
        }
    }
    void CloseWindow()
    {
        if (m_bIsNeedSendLevelCopySceneMsg)
        {
            CG_LEAVE_COPYSCENE packet = (CG_LEAVE_COPYSCENE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_LEAVE_COPYSCENE);
            packet.NoParam = -1;
            packet.SendPacket();
        }
        else
        {
            Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

            if (_mainPlayer != null && _mainPlayer.IsDie())
            {
                SendPlayerReliveMsg();
            }
        }
        UIManager.CloseUI(UIInfo.StoryCopySceneResultRoot);
    }
Esempio n. 5
0
        public override void UpdateAI()
        {
            base.UpdateAI();
            if (m_player == null || m_player.Controller == null)
            {
                return;
            }
            if (m_player.IsDie())
            {
                return;
            }
            if (m_player.Controller.CombatFlag == false)
            {
                return;
            }
            if (m_player.AutoComabat == false)
            {
                return;
            }
            //轻功状态下 不挂机
            if (m_player.QingGongState)
            {
                return;
            }
            if (m_player.AcceleratedMotion != null && m_player.AcceleratedMotion.Going == true)
            {
                return;
            }
            //剧情播放中不挂机
            if (m_player.IsInModelStory)
            {
                return;
            }
            // 跟随不挂机
            if (false == m_player.IsTeamLeader() && m_player.IsInTeamFollow)
            {
                return;
            }
            if (Cutscene.CutsceneManager.Instance.IsPlayingMovieStory)
            {
                return;
            }
            //阻塞状态不挂机
            if (Cutscene.CutsceneManager.Instance.BlockAutoBattle)
            {
                return;
            }
            //自动交接任务的寻路过程中不挂机
            if (null != GameManager.gameManager.AutoSearch &&
                true == GameManager.gameManager.AutoSearch.IsAutoSearching)
            {
                return;
            }
            //modify 普通攻击:可以连续按。在技能结束前可以再次释放不能直接return。
            if (m_player.SkillCore.IsUsingSkill)
            {
                bool shouldReturn = true;
                if ((Time.time * 1000 - CurUseSkillStartTime) >= m_nNormalSkillInterval)
                {
                    if (IsNormalSkill(CurUseSkillId))
                    {
                        shouldReturn = false;
                    }
                }
                if (shouldReturn)
                {
                    return;
                }
            }

            #region UnUsed

            /* if (m_player.SkillCore.IsUsingSkill)
             * {
             *
             *   return;
             *   if (m_player.SkillCore.UsingSkillBaseInfo != null && m_player.SkillCore.UsingSkillExInfo !=null)
             *   {
             *       //正在使用祝融掌 则检测下当前目标是否还存在 不存在则重新选取目标
             *       //if (m_player.SkillCore.UsingSkillBaseInfo.Id ==(int)SKILLBASEID.ZLZ)
             *       //{
             *       //    if (m_player.SelectTarget ==null || m_player.SelectTarget.IsDie())
             *       //    {
             *       //        Obj_Character _NewAttackCharacter = SeleCanAttackTar(m_player.SkillCore.UsingSkillExInfo.Radius);
             *       //        if (_NewAttackCharacter != null)
             *       //        {
             *       //            //设置新的选中目标
             *       //            m_player.OnSelectTarget(_NewAttackCharacter.gameObject,false);
             *       //            m_player.MoveTo(_NewAttackCharacter.transform.position, _NewAttackCharacter.gameObject,1.0f);
             *       //        }
             *       //    }
             *       //}
             *
             *       //连续技特殊判定:
             *       //1、判定玩家是否主动打断;
             *       //2、不判定是否释放完成,一直尝试是否可释放;
             *       if (IsPlayerBreakRepeatSkill())
             *       {
             *           ClearPlayerBreakRepeatSkill();
             *           return;
             *       }
             *       //非连续技则等待一帧
             *       if (!IsUsingRepeatSkillWithNext())
             *       {
             *           return;
             *       }
             *   }
             * }
             * else
             * {
             *   if (m_fLastUseEndTime <=0.1f)
             *   {
             *       m_fLastUseEndTime = Time.time;
             *   }
             * }*/
            #endregion
            //留个缓冲时间
            //if (Time.time -m_fLastUseEndTime <0.5f)
            //{
            //    return;
            //}
            //有轻功点了出现了 向轻功点移动
            if (m_player.AutoMovetoQGPointId != -1)
            {
                //打断挂机状态
                m_player.BreakAutoCombatState();

                /*if (GameManager.gameManager.RunningScene == (int)Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_YANZIWU)
                 * {
                 *  //燕子坞轻功点移动
                 *  m_player.AutoFightFlyInYanZiWu();
                 * }*/
                m_player.AutoMovetoQGPointId = -1;
                return;
            }
            m_fLastUseEndTime = 0.0f;
            int skillId = SeleSkill();
            if (skillId == -1)
            {
                return;
            }
            Tab_SkillEx skillExInfo = TableManager.GetSkillExByID(skillId, 0);
            if (skillExInfo == null)
            {
                return;
            }
            Tab_SkillBase skillBaseInfo = TableManager.GetSkillBaseByID(skillExInfo.BaseId, 0);
            if (skillBaseInfo == null)
            {
                return;
            }

            Obj_Character CanAttackCharacter = null;
            //如果当前选中的目标是敌对的了 则不需要再次选取目标
            if (m_player.SelectTarget != null && m_player.SelectTarget.IsDie() == false)
            {
                if (Reputation.IsEnemy(m_player.SelectTarget) ||
                    Reputation.IsNeutral(m_player.SelectTarget))
                {
                    CanAttackCharacter = m_player.SelectTarget;
                }
            }

            float skillRadius = skillExInfo.Radius;

            if (CanAttackCharacter == null ||
                (CanAttackCharacter != null && IsDisStartPointTooFar(skillRadius, CanAttackCharacter.Position))
                )
            {
                CanAttackCharacter = SeleCanAttackTar(skillRadius);
            }
            //是否有攻击目标 没有攻击目标就不要自动放技能了
            if (CanAttackCharacter == null)
            {
                /*
                 * if (GameManager.gameManager.RunningScene == (int)Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_ZHENLONGQIJU)
                 * {
                 *  Vector3 pos = new Vector3(18, m_player.gameObject.transform.position.y, 16);
                 *  m_player.MoveTo(pos, null, 0.0f);
                 *
                 * }
                 * if (GameManager.gameManager.RunningScene == (int)Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_YANGWANGGUMU)
                 * {
                 *  Vector3 pos = new Vector3(20, m_player.gameObject.transform.position.y, 21);
                 *  m_player.MoveTo(pos, null, 0.0f);
                 * }
                 *
                 * if (GameManager.gameManager.RunningScene == (int)Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_YANZIWU)
                 * {
                 *  m_player.AutoFightInYanziwu();
                 * }
                 * if (GameManager.gameManager.RunningScene == (int)Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_FOURVILLAIN)
                 * {
                 *  Singleton<ObjManager>.Instance.MainPlayer.AutoFightInFourVillain();
                 * }
                 */
                if (GameManager.gameManager.ActiveScene != null && GameManager.gameManager.ActiveScene.IsStoryCopyScene())
                {
                    if (Singleton <ObjManager> .GetInstance().MainPlayer != null)
                    {
                        if (Singleton <ObjManager> .GetInstance().MainPlayer.AutoComabat)
                        {
                            float x = 0.0f, y = 0.0f, z = 0.0f;
                            if (GameManager.gameManager.ActiveScene.GetGuideDestination(ref x, ref z))
                            {
                                y = GameManager.gameManager.ActiveScene.GetTerrainHeight(new Vector3(x, 0.0f, z));
                                Singleton <ObjManager> .GetInstance().MainPlayer.MoveTo(new Vector3(x, y, z), null, 0.0f);
                            }
                        }
                    }
                }
                return;
            }
            //如果在野外场景攻击其它玩家return;
            if (CanAttackCharacter.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
            {
                if (GameManager.gameManager.ActiveScene.IsWildeScene())
                {
                    return;
                }
            }
            //设置为选中目标
            m_player.OnSelectTarget(CanAttackCharacter.gameObject, false);
            //距离不过 先跑过去
            float dis          = Vector3.Distance(m_player.Position, CanAttackCharacter.Position);
            float diffDistance = dis - skillRadius;
            m_player.CurUseSkillId = skillId;
            //需要向目标移动 则想目标移动
            if (diffDistance > 0 && skillBaseInfo.IsMoveToTarInAutoCombat == 1)
            {
                //move
                if (m_player.IsMoving == false && m_player.IsCanOperate_Move())
                {
                    m_player.MoveTo(CanAttackCharacter.Position, CanAttackCharacter.gameObject, skillRadius - 1.0f);
                    return;
                }
            }
            m_player.UseSkillOpt(skillId, null);
        }
Esempio n. 6
0
    /// <summary>
    /// Applies the animation.
    /// </summary>
    private void ApplyAnim()
    {
        //有震屏需求 摄像机抖动
        if (m_CameraAnimInfoList.Count > 0)
        {
            Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

            if (mainPlayer == null)
            {
                return;
            }

            bool IsRocking = false;
            for (int i = m_CameraAnimInfoList.Count - 1; i >= 0; i--)
            {
                if (m_CameraAnimInfoList[i].IsValid() == false)
                {
                    m_CameraAnimInfoList.RemoveAt(i);
                    continue;
                }
                //struct 先拷贝出一份出来 修改完后 记得再赋值更新
                CameraRockInfo _TmpInfo = m_CameraAnimInfoList[i];
                //死了就不震了
                if (_TmpInfo.m_bContinueRockDie == false && mainPlayer.IsDie())
                {
                    if (null != _TmpInfo.m_RockFinishCallback)
                    {
                        _TmpInfo.m_RockFinishCallback.Invoke();
                    }
                    _TmpInfo.CleanUp();
                }
                else
                {
                    if (_TmpInfo.m_fDelayTime > 0)
                    {
                        _TmpInfo.m_fDelayTime -= Time.deltaTime;
                    }
                    else
                    {
                        if (_TmpInfo.m_fDelayTime <= 0)
                        {
                            if (_TmpInfo.m_fRockTime - _TmpInfo.m_fNeedRockTime >= 0)
                            {
                                if (null != _TmpInfo.m_RockFinishCallback)
                                {
                                    _TmpInfo.m_RockFinishCallback.Invoke();
                                }
                                //震完了 清理数据
                                _TmpInfo.CleanUp();
                            }
                            else
                            {
                                _TmpInfo.m_fRockTime += Time.deltaTime;
                                m_fPitchAnim          = m_CameraAnimInfoList[i].m_PitchRockOff.Evaluate(m_CameraAnimInfoList[i].m_fRockTime);
                                m_fYawAnim            = m_CameraAnimInfoList[i].m_YawRockOff.Evaluate(m_CameraAnimInfoList[i].m_fRockTime);
                                m_fDistanceAnim       = m_CameraAnimInfoList[i].m_DistanceRockOff.Evaluate(m_CameraAnimInfoList[i].m_fRockTime);
                                m_fOffsetAnim         = m_CameraAnimInfoList[i].m_OffsetYRockOff.Evaluate(m_CameraAnimInfoList[i].m_fRockTime);
                                IsRocking             = true;
                            }
                        }
                    }
                }
                //重新赋值更新
                m_CameraAnimInfoList[i] = _TmpInfo;
                if (IsRocking)
                {
                    break;
                }
            }
            if (IsRocking == false)
            {
                m_fPitchAnim    = 0;
                m_fYawAnim      = 0;
                m_fDistanceAnim = 0;
                m_fOffsetAnim   = 0;
            }
        }
        else
        {
            m_fPitchAnim    = 0;
            m_fYawAnim      = 0;
            m_fDistanceAnim = 0;
            m_fOffsetAnim   = 0;
        }
    }