Esempio n. 1
0
        private Vector3 GetFellowPos(Obj_MainPlayer mainPlayer)
        {
            float fAngle = (float)(Math.PI * (5.0f / 4.0f));
            int   nDist  = 1;

            Vector3 retPos = Position;
            //主角位置
            Vector3 mainPos = mainPlayer.Position;
            //主角朝向
            float mainDir = Utils.DirClientToServer(mainPlayer.Rotation);

            mainDir = Utils.NormaliseDirection(mainDir);

            retPos.x = (float)(nDist * Math.Cos(fAngle));
            retPos.z = (float)(nDist * Math.Sin(fAngle));
            //旋转
            float x = (float)(retPos.x * Math.Cos(mainDir) - retPos.z * Math.Sin(mainDir));
            float z = (float)(retPos.z * Math.Cos(mainDir) + retPos.x * Math.Sin(mainDir));

            retPos.x = x;
            retPos.z = z;
            //平移
            retPos.x += mainPos.x;
            retPos.z += mainPos.z;

            return(retPos);
        }
Esempio n. 2
0
        private void UpdateFellowMove()
        {
            SetMoveSpeedAsMainPlayer();
            Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

            //TODO 判读是否在战斗
            Vector3 targetPos = GetFellowPos(mainPlayer);

            if (Vector3.Distance(Position, targetPos) >= 6)
            {
                //距离太远 直接拉过去
                if (NavAgent != null)
                {
                    UnityEngine.GameObject.DestroyImmediate(NavAgent);
                }
                m_ObjTransform.position = ActiveScene.GetTerrainPosition(new Vector3(targetPos.x, 0f, targetPos.z));
                if (NavAgent == null)
                {
                    InitNavAgent();
                }
            }
            else if (Vector3.Distance(Position, targetPos) >= 2 || (IsMoving && Vector3.Distance(Position, targetPos) >= 1))
            {
                MoveTo(targetPos, null, 0f);
            }
        }
Esempio n. 3
0
 void ItemThrowOK()
 {
     Games.LogicObj.Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer;
     if (m_Item != null && m_Item.IsValid() && null != mainPlayer)
     {
         if (mainPlayer.CheckThrowItem(m_Item))
         {
             mainPlayer.ThrowItem(m_Item);
         }
         CloseWindow();
     }
 }
Esempio n. 4
0
    // 骑乘button
    void RidingButton(GameObject value)
    {
        // 给服务器发消息 骑乘
        // 客户端模拟
        int nMountID = GameManager.gameManager.PlayerDataPool.m_objMountParam.MountID;

        if (nMountID != m_CurMountID)
        {
            // 没有的坐骑 弹提示

            if (false == GameManager.gameManager.PlayerDataPool.m_objMountParam.GetMountCollectFlag(m_CurMountID))
            {
                Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{3051}");

                return;
            }
            else
            {
                GameManager.gameManager.SoundManager.PlaySoundEffect(30);
                //Singleton<ObjManager>.GetInstance().MainPlayer.RideMount(m_CurMountID);
                CG_MOUNT_MOUNT packet = (CG_MOUNT_MOUNT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_MOUNT_MOUNT);
                packet.SetMountID(m_CurMountID);
                packet.SendPacket();

                Games.LogicObj.Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

                if (mainPlayer != null)
                {
                    mainPlayer.PlayerStopMountSound();
                }
            }
        }
        else // 下坐骑
        {
            //Singleton<ObjManager>.GetInstance().MainPlayer.UnMount();
            CG_MOUNT_UNMOUNT packet = (CG_MOUNT_UNMOUNT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_MOUNT_UNMOUNT);
            packet.SetMountID(m_CurMountID);
            packet.SendPacket();

            Games.LogicObj.Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

            if (mainPlayer != null)
            {
                mainPlayer.NoPlayerStopMountSound();
            }
        }

        /*if (PartnerAndMountLogic.Instance())
         * {
         *  PartnerAndMountLogic.Instance().CloseWindow();
         * }*/
    }
Esempio n. 5
0
        void OnTriggerEnter(Collider other)
        {
            Obj_MainPlayer mainPlayer = other.gameObject.GetComponent <Obj_MainPlayer>();

            if (null != mainPlayer)
            {
                if (mainPlayer.GUID == OwnerGuid)
                {
                    CG_ASK_PICKUP_ITEM packet = (CG_ASK_PICKUP_ITEM)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ASK_PICKUP_ITEM);
                    packet.SetObjId(ServerID);
                    packet.SendPacket();
                }
            }
        }
Esempio n. 6
0
        public void UpdateMove(float fSpeed)
        {
            Obj_MainPlayer OwnerUser = Singleton <ObjManager> .Instance.MainPlayer;

            if (null != OwnerUser && OwnerUser.GUID == OwnerGuid && OwnerUser.IsDie() == false && m_ObjTransform != null)
            {
                Vector3 OwnerPos = OwnerUser.transform.position;
                OwnerPos.y += 1;
                Vector3 pos    = OwnerPos - m_ObjTransform.position;
                Vector3 newPos = pos * fSpeed * Time.deltaTime;
                m_ObjTransform.position  += newPos;
                m_ObjTransform.localScale = m_localScale * m_fScaling;
                m_fScaling = 1;
            }
        }
Esempio n. 7
0
 // 点击MissionItem
 void MissionItemClicked()
 {
     if (NewPlayerGuidLogic.IsOpenFlag)
     {
         NewPlayerGuidLogic.CloseWindow();
     }
     if (GameManager.gameManager.MissionManager != null)
     {
         GameManager.gameManager.MissionManager.MissionPathFinder(m_MissionID);
     }
     Games.LogicObj.Obj_MainPlayer mainPalyer = Singleton <ObjManager> .Instance.MainPlayer;
     if (null != mainPalyer && null != mainPalyer.SkillCore &&
         mainPalyer.SkillCore.UsingSkillBaseInfo != null &&
         mainPalyer.SkillCore.UsingSkillBaseInfo.IsMoveBreak == 1)
     {
         mainPalyer.SkillCore.BreakCurSkill();
     }
 }
Esempio n. 8
0
        //战斗状态
        void ProcessCombatAnimState()
        {
            if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
            {
                // 玩家装备了坐骑
                Obj_MainPlayer MainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

                if (MainPlayer.IsDie() == false && MainPlayer.GetEquipMountID() > 0 && MainPlayer.MountObj)
                {
                    m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.AttackStand);
                    MainPlayer.MountObj.PlayMountPlayerAnima(CharacterDefine.MountAction.STAND, MainPlayer);
                }
                else
                {
                    m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.AttackStand));
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 冲撞移动函数
        /// </summary>
        public void CrashMove()
        {
            if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
            {
                Obj_MainPlayer _mainPlayer = this as Obj_MainPlayer;

                if (null == _mainPlayer)
                {
                    return;
                }

                if (!_mainPlayer.IsHitPoint && null != _mainPlayer.SkillCore && _mainPlayer.SkillCore.IsUsingCrashSkill())
                {
                    //如果已经在移动不处理
                    if (_mainPlayer.IsMoving)
                    {
                        return;
                    }

                    if (_mainPlayer.SkillCore.LastUseSkillTime < 0)
                    {
                        return;
                    }


                    Vector3 vecDir = new Vector3(0, 0, 0);
                    float   fDir   = Utils.DirClientToServer(Rotation);
                    fDir     = Utils.NormaliseDirection(fDir);
                    vecDir.x = Mathf.Cos(fDir);
                    vecDir.z = Mathf.Sin(fDir);
                    vecDir   = vecDir.normalized;

                    Vector3 movement = vecDir * BaseAttr.MoveSpeed;
                    movement *= Time.deltaTime;
                    if (_mainPlayer.SkillCore.UsingSkillExInfo.SkillContinueTime / 1000.0f - (Time.time - _mainPlayer.SkillCore.LastUseSkillTime) < 0)
                    {
                        return;
                    }
                    Vector3 tarPosition = _mainPlayer.ObjTransform.localPosition + movement * 10;

                    MoveTo(tarPosition, null, 0.0f);
                }
            }
        }
Esempio n. 10
0
    //点击 加为好友
    void OnClickFriend()
    {
        //如果非玩家,则不显示
        if (m_CurSelectMemberGuid == GlobeVar.INVALID_GUID || m_CurSelectMemberGuid == 0)
        {
            return;
        }

        Games.LogicObj.Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

        if (null == mainPlayer)
        {
            return;
        }
        //如果目标是自己也不发送加好友
        if (m_CurSelectMemberGuid == mainPlayer.GUID)
        {
            return;
        }

        if (GameManager.gameManager.PlayerDataPool.FriendList.IsExist(m_CurSelectMemberGuid))
        {
            mainPlayer.SendNoticMsg(false, "#{2394}");
            return;
        }

        /* if (GameManager.gameManager.PlayerDataPool.BlackList.IsExist(m_CurSelectMemberGuid))
         * {
         *   mainPlayer.SendNoticMsg(false, "#{4723}");
         *   return;
         * }  */

        CG_ADDFRIEND msg = (CG_ADDFRIEND)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ADDFRIEND);

        msg.Guid = m_CurSelectMemberGuid;
        msg.SendPacket();

        mainPlayer.SendNoticMsg(false, "#{2906}");
    }
Esempio n. 11
0
        //行走状态处理
        void ProcessWalkAnimState()
        {
            //移动时 还在播受击动作或者击倒动作 则停止播放
            if (AnimLogic != null &&
                AnimLogic.CurAnimData != null)
            {
                if (AnimLogic.CurAnimData.AnimID == (int)CharacterDefine.CharacterAnimId.Hit ||
                    AnimLogic.CurAnimData.AnimID == (int)CharacterDefine.CharacterAnimId.Knockback_01)
                {
                    m_AnimLogic.Stop();
                }
                if (IsLightState == false && AnimLogic.CurAnimData.AnimID == (int)CharacterDefine.CharacterAnimId.LIGHTSKILLEND)
                {
                    m_AnimLogic.Stop();
                }
            }
            if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
            {
                // 玩家装备了坐骑
                Obj_MainPlayer MainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

                if (MainPlayer.IsDie() == false && MainPlayer.GetEquipMountID() > 0 && MainPlayer.MountObj)
                {
                    m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Walk);
                    CharacterDefine.MountAction nMountPlayerAniID = CharacterDefine.MountAction.RUN;
                    if (MainPlayer.GetEquipMountID() == GlobeVar.MOUNT_TIANLONG_ID)
                    {
                        nMountPlayerAniID = CharacterDefine.MountAction.STAND;
                    }
                    MainPlayer.MountObj.PlayMountPlayerAnima(nMountPlayerAniID, MainPlayer);
                }
                else
                {
                    m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.Walk));
                }
            }
            else
            {
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
                {
                    Obj_OtherPlayer OtherPlayer = this.GetComponent <Obj_OtherPlayer>();
                    if (OtherPlayer && OtherPlayer.IsDie() == false && OtherPlayer.MountID > 0 && OtherPlayer.MountObj)
                    {
                        m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Walk);
                        CharacterDefine.MountAction nMountPlayerAniID = CharacterDefine.MountAction.RUN;
                        if (OtherPlayer.MountID == GlobeVar.MOUNT_TIANLONG_ID)
                        {
                            nMountPlayerAniID = CharacterDefine.MountAction.STAND;
                        }
                        OtherPlayer.MountObj.PlayMountPlayerAnima(nMountPlayerAniID, OtherPlayer);
                    }
                    else
                    {
                        m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.Walk));
                    }
                }
                else
                {
                    m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.Walk));
                }
            }
            if (ObjEffectController != null)
            {
                ObjEffectController.OnMove();
            }
        }
Esempio n. 12
0
        //待机状态处理
        void ProcessIdleAnimState(bool playEffectImmediately = true)
        {
            if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
            {
                // 玩家装备了坐骑
                Obj_MainPlayer MainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

                if (MainPlayer.IsDie() == false && MainPlayer.GetEquipMountID() > 0 && MainPlayer.MountObj)
                {
                    m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Stand);
                    MainPlayer.MountObj.PlayMountPlayerAnima(CharacterDefine.MountAction.STAND, MainPlayer);
                }
                else
                {
                    if (MainPlayer.InDizzy)
                    {
                        m_AnimLogic.Stop();
                        m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.DizzyId);
                        return;
                    }

                    if (MainPlayer.InCombat)
                    {
                        m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.AttackStand);
                    }
                    else
                    {
                        m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Stand);
                    }
                }
            }
            else
            {
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
                {
                    Obj_OtherPlayer OtherPlayer = this as Obj_OtherPlayer;
                    if (OtherPlayer && OtherPlayer.IsDie() == false && OtherPlayer.MountID > 0 && OtherPlayer.MountObj)
                    {
                        m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Stand);
                        OtherPlayer.MountObj.PlayMountPlayerAnima(CharacterDefine.MountAction.STAND, OtherPlayer);
                    }
                    else
                    {
                        if (OtherPlayer.InDizzy)
                        {
                            m_AnimLogic.Stop();
                            m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.DizzyId);
                            return;
                        }
                        m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.Stand));
                    }
                }
                else
                {
                    if (this.InDizzy)
                    {
                        m_AnimLogic.Stop();
                        m_AnimLogic.Play((int)CharacterDefine.CharacterAnimId.DizzyId);
                        return;
                    }
                    //如果是其他Obj,就需要根据DataID区分是否为战斗型的NPC
                    //非战斗NPC默认播放Stand动作
                    //战斗NPC播放AttackStand动作
                    Tab_RoleBaseAttr roleBaseTab = TableManager.GetRoleBaseAttrByID(BaseAttr.RoleBaseID, 0);
                    if (null != roleBaseTab && roleBaseTab.CombatNPC > 0)
                    {
                        //是战斗NPC,播放AttackStand
                        if (playEffectImmediately)
                        {
                            m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.AttackStand));
                        }
                    }
                    else
                    {
                        m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.Stand));
                    }
                }
            }
            if (ObjEffectController != null)
            {
                ObjEffectController.OnIdle();
            }
        }
Esempio n. 13
0
        public void StopMove()
        {
            if (null != NavAgent && NavAgent.enabled == true)
            {
                NavAgent.Stop();
                //如果在moveto时 禁用了旋转 移动结束后 重新置为打开
                if (IsMoveToNoFaceTo)
                {
                    EnableMovingRotation(true);
                    IsMoveToNoFaceTo = false;
                }
            }

            if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
            {
//                Obj_MainPlayer MainPlayer = this as Obj_MainPlayer;
                //if (MainPlayer.Thirdcontroller != null && MainPlayer.Thirdcontroller.IsMoving)
                //{
                //    CurObjAnimState = Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_WALK;
                //}
                //else
                //{
                CurObjAnimState = Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_NORMOR;
                //}
                //取消地面移动特效
                if (null != GameManager.gameManager.ActiveScene)
                {
                    GameManager.gameManager.ActiveScene.DeactiveMovingCircle();
                }
            }
            else
            {
#if UNITY_ANDROID
                if (ObjType != Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
                {
#endif
                CurObjAnimState = Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_NORMOR;

#if UNITY_ANDROID
            }
#endif
            }

            //正常结束处理
            bool isPlayerSound = m_bIsMoving;
            m_bIsMoving  = false;
            m_bIsTracing = false;
            float fDis = Vector3.Distance(this.Position, m_vecTargetPos);
            if (m_fStopRange - fDis >= 0)
            {
                OnMoveOver();
            }

            //   MoveTarget = null;
            ResetMoveOverEvent();

            //重置移动卡住校验
            m_LastPosition     = Vector3.zero;
            m_LastPositionTime = 0;

            Obj_MainPlayer MainPlayer1 = this as Obj_MainPlayer;
            if (MainPlayer1 != null)
            {
                if (isPlayerSound)
                {
                    MainPlayer1.PlayerStopMountSound();
                    MainPlayer1.PlayerMountStopMoveSound();
                }
            }
        }
Esempio n. 14
0
        //更新Obj_DropItem逻辑数据
        void FixedUpdate()
        {
            //不要频繁发包,5秒发一次
            if (bIsDrop == false)
            {
                if (Time.realtimeSinceStartup - m_fDropTimeSecond > 5)
                {
                    m_fDropTimeSecond = Time.realtimeSinceStartup;
                    bIsDrop           = true;
                }
                else
                {
                    return;
                }
            }

            //延迟发送
            if (bIsSendDrop == false)
            {
                if (Time.realtimeSinceStartup - m_fSendDropTimeSecond > m_fMoveSecond)
                {
                    SendDropItem();
                    m_fSendDropTimeSecond = Time.realtimeSinceStartup;
                    bIsSendDrop           = true;
                    gameObject.SetActive(false);
                    // UpdateMove(100);
                }
                else
                {
                    UpdateMove(m_fSpeed);
                }

                return;
            }

            if (Time.realtimeSinceStartup - m_fUpdateTimeSecond > m_fStop)
            {
                m_fUpdateTimeSecond = Time.realtimeSinceStartup;
                //更新拾取
                Obj_MainPlayer OwnerUser = Singleton <ObjManager> .Instance.MainPlayer;
                if (null != OwnerUser && OwnerUser.GUID == OwnerGuid && OwnerUser.IsDie() == false)
                {
                    if (OwnerUser.GetAutoCombatState() == true)// 挂机中自动拾取
                    {
                        if (DropType == (int)Games.GlobeDefine.GameDefine_Globe.DROP_TYPE.DROP_ITEM)
                        {
                            Tab_CommonItem line = TableManager.GetCommonItemByID(m_nItemId, 0);
                            if (line != null)
                            {
                                //计算品级及拾取规则
//                                 if ((line.ClassID == (int)ItemClass.EQUIP && OwnerUser.GetAutoPickUpFlag(line.Quality))
//                                    || (line.ClassID == (int)ItemClass.STRENGTHEN && OwnerUser.GetAutoPickUpFlag((int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_PICKUP_TYPE.PICKUP_STUFF))
//                                    || (line.ClassID != (int)ItemClass.EQUIP && line.ClassID != (int)ItemClass.STRENGTHEN && OwnerUser.GetAutoPickUpFlag((int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_PICKUP_TYPE.PICKUP_OTHER)))
                                {
                                    GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;
                                    if (BackPack.GetCanContainerSize() <= 0)
                                    {
                                        OwnerUser.SendNoticMsg(true, "#{1039}");
                                        bIsDrop = false;
                                        return;
                                    }
                                    //SendDropItem();
                                    bIsSendDrop           = false;
                                    m_fSendDropTimeSecond = Time.realtimeSinceStartup;
                                }
                            }
                        }
                        else if (DropType == (int)Games.GlobeDefine.GameDefine_Globe.DROP_TYPE.DROP_COIN)
                        {
                            //SendDropItem();
                            bIsSendDrop           = false;
                            m_fSendDropTimeSecond = Time.realtimeSinceStartup;
                            StopEffect(175, true);
                            PlayEffect(176);
                        }
                    }
                    else if (Vector3.Distance(OwnerUser.transform.position, this.gameObject.transform.position) <= fActiveRadius)
                    {
                        GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;
                        if (BackPack.GetCanContainerSize() <= 0 && DropType == (int)Games.GlobeDefine.GameDefine_Globe.DROP_TYPE.DROP_ITEM)
                        {
                            OwnerUser.SendNoticMsg(true, "#{1039}");
                            bIsDrop = false;
                            return;
                        }
                        //SendDropItem();
                        bIsSendDrop           = false;
                        m_fSendDropTimeSecond = Time.realtimeSinceStartup;
                        if (DropType == (int)Games.GlobeDefine.GameDefine_Globe.DROP_TYPE.DROP_COIN)
                        {
                            StopEffect(175, true);
                            PlayEffect(176);
                        }
                    }
                }
            }
        }
Esempio n. 15
0
        public virtual void UpdateAttrBroadcastPackt(GC_BROADCAST_ATTR packet)
        {
            //bind parent
            if (packet.HasBindparent)
            {
                BindParent = packet.Bindparent;
            }
            //bind children
            // 没数据 也别更新啦
            if (packet.bindchildrenCount > 0)
            {
                List <int> newlist = new List <int>(packet.bindchildrenList);
                UpdateBindChildren(newlist);
            }
            if (packet.HasName)
            {
                if (!string.IsNullOrEmpty(packet.Name))
                {
                    char   firstChar    = packet.Name[0];
                    string szNameResult = "";
                    if (firstChar == '#' && 0 == StrDictionary.GetServerDictionaryFormatString(packet.Name, ref szNameResult))
                    {
                        BaseAttr.RoleName = szNameResult;
                    }
                    else
                    {
                        BaseAttr.RoleName = packet.Name;
                    }
                }
                OptNameChange();
            }
            if (packet.HasCurForce)
            {
                BaseAttr.Force = packet.CurForce;
                OptForceChange();
            }
            if (packet.HasVipCost)
            {
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
                {
                    Obj_MainPlayer mainPlayer = this as Obj_MainPlayer;
                    if (mainPlayer != null)
                    {
                        mainPlayer.VipCost = packet.VipCost;
                        //更新自动挂机
                        if (mainPlayer.BaseAttr.Level >= GlobeVar.MAX_AUTOEQUIT_LIVE && VipData.GetVipLv() >= GlobeVar.USE_AUTOFIGHT_VIPLEVEL)
                        {
                            //vip2的时候选择自动强化
                            mainPlayer.UpdateSelectEquip();
                        }
                    }
                }
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
                {
                    Obj_OtherPlayer otherPlayer = this as Obj_OtherPlayer;
                    if (otherPlayer != null)
                    {
                        otherPlayer.VipCost = packet.VipCost;
                    }
                }
            }
            if (packet.HasCombatValue)
            {
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
                {
                    Obj_MainPlayer mainPlayer = this as Obj_MainPlayer;
                    if (mainPlayer != null)
                    {
                        mainPlayer.OtherCombatValue = packet.CombatValue;
                        mainPlayer.UpdateCombatValue();
                    }
                }
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
                {
                    Obj_OtherPlayer otherPlayer = this as Obj_OtherPlayer;
                    if (otherPlayer != null)
                    {
                        otherPlayer.OtherCombatValue = packet.CombatValue;
                        otherPlayer.UpdateCombatValue();
                    }
                }
            }

            if (packet.HasMoveSpeed)
            {
                BaseAttr.MoveSpeed = packet.MoveSpeed / 100.0f;
                if (NavAgent != null)
                {
                    NavAgent.speed = BaseAttr.MoveSpeed;
                }

                //主角的伙伴需要特殊处理
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_FELLOW)
                {
                    Obj_Fellow fellowObj = this as Obj_Fellow;
                    if (null != fellowObj && fellowObj.IsOwnedByMainPlayer())
                    {
                        fellowObj.SetMoveSpeedAsMainPlayer();
                    }
                }
                //主角速度变化把自己伙伴的速度也改变
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
                {
                    Obj_MainPlayer mainPlayer = this as Obj_MainPlayer;
                    if (mainPlayer != null)
                    {
                        Obj_Fellow fellowObj = mainPlayer.GetCurFellow();
                        if (fellowObj != null)
                        {
                            fellowObj.SetMoveSpeedAsMainPlayer();
                        }
                    }
                }
            }
            if (packet.HasBDie)
            {
                bool bDie = packet.BDie == 1;
                if (bDie == true)
                {
                    OnDie();
                }
            }
            if (packet.HasStealthLev)
            {
                StealthLev = packet.StealthLev;
                OptStealthLevChange();
            }
        }
Esempio n. 16
0
        public static CharacterDefine.REPUTATION_TYPE GetObjReputionType(Obj_Character objChar, bool bPKListIsConsider = true)
        {
            Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

            if (_mainPlayer == null)
            {
                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_INVALID);
            }
            if (objChar == null)
            {
                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_INVALID);
            }
            CharacterDefine.REPUTATION_TYPE type = CharacterDefine.REPUTATION_TYPE.REPUTATION_INVALID;
            Tab_Relation reputation = TableManager.GetRelationByID(objChar.BaseAttr.Force, 0);

            if (null != reputation)
            {
                type = (CharacterDefine.REPUTATION_TYPE)reputation.GetRelationbyIndex((int)_mainPlayer.BaseAttr.Force);
            }
            //自己跟自己 永远是友好关系
            if (objChar.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
            {
                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_FRIEND);
            }
            //是玩家 且是友好关系 则进一步判断是否是PK状态
            if (objChar.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER &&
                type == CharacterDefine.REPUTATION_TYPE.REPUTATION_FRIEND)
            {
                Obj_OtherPlayer _Player = objChar as Obj_OtherPlayer;
                if (_Player)
                {
                    //同队伍和同帮会 伴侣 不能互相PK 不受PK模式影响
                    if ((GameManager.gameManager.PlayerDataPool.IsHaveGuild() == false || GameManager.gameManager.PlayerDataPool.IsGuildMember(_Player) == false) &&
                        (GameManager.gameManager.PlayerDataPool.IsHaveTeam() == false || GameManager.gameManager.PlayerDataPool.IsTeamMem(_Player.GUID) == false) &&
                        GameManager.gameManager.PlayerDataPool.LoverGUID != _Player.GUID && //是否是伴侣
                        GameManager.gameManager.ActiveScene.IsCopyScene() == false          //是否是副本
                        )
                    {
                        //对方是杀戮模式且在反击列表为敌对关系
                        if (_Player != null && _Player.PkModle == (int)CharacterDefine.PKMODLE.KILL)
                        {
                            //新需求为:如果玩家在和平模式下点击切换目标按钮,则先切换到周围杀戮模式的玩家,不需要在反击列表
                            if (_Player.IsInMainPlayerPKList)
                            {
                                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_HOSTILE);
                            }
                            else if (!bPKListIsConsider)
                            {
                                return(CharacterDefine.REPUTATION_TYPE.REPUTATION_HOSTILE);
                            }
                        }
                        //主角是杀戮模式 为敌对关系
                        if (_mainPlayer.PkModle == (int)CharacterDefine.PKMODLE.KILL)
                        {
                            return(CharacterDefine.REPUTATION_TYPE.REPUTATION_HOSTILE);
                        }
                        if (_Player.IsWildEnemyForMainPlayer)
                        {
                            return(CharacterDefine.REPUTATION_TYPE.REPUTATION_HOSTILE);
                        }
                    }
                }
            }
            return(type);
        }
Esempio n. 17
0
        //======================================================

        public bool IsCanAddAutoSkill(int skillId)
        {
            Tab_SkillEx SkillExinfo = TableManager.GetSkillExByID(skillId, 0);

            if (SkillExinfo == null)
            {
                return(false);
            }
            Tab_SkillBase SkillBase = TableManager.GetSkillBaseByID(SkillExinfo.BaseId, 0);

            if (SkillBase == null)
            {
                return(false);
            }

            // 4个 普通技能
            if ((SkillBase.SkillClass & (int)SKILLCLASS.AUTOREPEAT) == 0 &&
                (SkillBase.SkillClass & (int)SKILLCLASS.CHANGEMODE) == 0 &&
                (SkillBase.SkillClass & (int)SKILLCLASS.XP) == 0 &&
                (SkillBase.SkillClass & (int)SKILLCLASS.PASSIVITY) == 0
                )
            {
                return(true);
            }

            //// 一二变区分
            // first
            return(false);

            if (SkillBase.LevelUpIndex != GlobeVar.INVALID_ID && SkillBase.LevelUpIndex / 10 >= 1 && SkillBase.LevelUpIndex / 10 < 2)
            {
                //xp
                if ((SkillBase.SkillClass & (int)SKILLCLASS.XP) > 0)
                {
                    return(true);
                }
                else if ((SkillBase.SkillClass & (int)SKILLCLASS.CHANGEMODE) > 0)
                {
                    Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

                    if (PlayerPreferenceData.PVESkillIdCurUsing >= 0 && PlayerPreferenceData.PVESkillIdCurUsing < _mainPlayer.OwnSkillInfo.Length)
                    {
                        if (_mainPlayer.OwnSkillInfo[PlayerPreferenceData.PVESkillIdCurUsing].SkillId == skillId)
                        {
                            return(true);
                        }
                    }
                }
            }

            //second
            else if (SkillBase.LevelUpIndex != GlobeVar.INVALID_ID && SkillBase.LevelUpIndex / 10 >= 2)
            {
                //xp
                if ((SkillBase.SkillClass & (int)SKILLCLASS.XP) > 0)
                {
                    return(true);
                }
                else if ((SkillBase.SkillClass & (int)SKILLCLASS.CHANGEMODE) > 0)
                {
                    Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

                    if (PlayerPreferenceData.PVPSkillIdCurUsing >= 0 && PlayerPreferenceData.PVESkillIdCurUsing < _mainPlayer.OwnSkillInfo.Length)
                    {
                        if (_mainPlayer.OwnSkillInfo[PlayerPreferenceData.PVPSkillIdCurUsing].SkillId == skillId)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }