Example #1
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;
            }
        }
Example #2
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));
                }
            }
        }
Example #3
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();
            }
        }
Example #4
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();
            }
        }
Example #5
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);
                        }
                    }
                }
            }
        }