Example #1
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);
                        }
                    }
                }
            }
        }