コード例 #1
0
ファイル: DropBehaviour.cs プロジェクト: wuhuolong/MaxBooks
        void OnLoadDropObjectFinished(GameObject dropGameObject, PkgDropGive dropInfo, DropComponent.EDropType dropType)
        {
#if UNITY_EDITOR
            dropGameObject.name = string.Format("Drop_{0}_{1}", dropInfo.oid, dropInfo.gid);
#endif
            if (dropType == DropComponent.EDropType.Noncompetitive || dropInfo.pos == null)
            {
                dropGameObject.transform.position = InstanceDropManager.GetInstance().GenerateDropPosition(mDropPosition, 0);
            }
            else
            {
                //GameDebug.LogError("Create drop1 " + dropInfo.oid + ", pos " + dropInfo.pos.px * GlobalConst.UnitScale + " " + dropInfo.pos.py * GlobalConst.UnitScale);

                Vector3 pos = new Vector3((float)dropInfo.pos.px * GlobalConst.UnitScale, 0, (float)dropInfo.pos.py * GlobalConst.UnitScale);
                //pos.y = PhysicsHelp.GetHeight(pos.x, pos.z);
                //pos = InstanceHelper.ClampInWalkableRange(pos);
                pos.y = PhysicsHelp.GetHeight(pos.x, pos.z);
                dropGameObject.transform.position = pos;

                //GameDebug.LogError("Create drop2 " + dropInfo.oid + ", pos " + pos.ToString());
            }
            var dropComponent = dropGameObject.transform.Find("Mesh").GetComponent <DropComponent>();
            dropComponent.DropType = dropType;
            dropComponent.DropInfo = dropInfo;
            dropComponent.Init();
        }
コード例 #2
0
    public void Destroy()
    {
        if (mIsBossChip && CanPick)
        {
            OnTouchExit();
        }

        mDropInfo        = null;
        mDropType        = EDropType.None;
        mCanPick         = false;
        CanNotPickReason = 0;
        mPickSqrRadius   = 0f;
        mIsTouching      = false;

        if (mTimer != null)
        {
            mTimer.Destroy();
            mTimer = null;
        }

        if (mDisappearTimer != null)
        {
            mDisappearTimer.Destroy();
            mDisappearTimer = null;
        }

        ClearCD();

        InstanceDropManager.GetInstance().RemoveDrop(this);

        if (mDropIconRes != null)
        {
            mDropIconRes.destroy();
            mDropIconRes = null;
        }

        if (mAutoPickCoroutine != null)
        {
            mAutoPickCoroutine.Stop();
            mAutoPickCoroutine = null;
        }

        mDropGoodsSubType = 0;
        mIsBossChip       = false;
        if (mBossChipEffectGameObject != null)
        {
            GameObject.DestroyImmediate(mBossChipEffectGameObject);
            mBossChipEffectGameObject = null;
        }

        mCurLoadEffectID = 0;
        mCurLoadIconID   = 0;

        m_IsDestory = true;
    }
コード例 #3
0
    public void Init()
    {
        m_IsDestory = false;

        mPosition   = this.transform.parent.position;
        mPosition.y = 0f;

        if (mDropInfo != null)
        {
            if (DBInstanceTypeControl.Instance.AutoPickDrop(InstanceManager.Instance.InstanceType, InstanceManager.Instance.InstanceSubType) == true)
            {
                if ((mDropInfo.type == GameConst.GIVE_TYPE_GOODS || mDropInfo.type == GameConst.GIVE_TYPE_EQUIP) && ItemManager.Instance.BagIsFull(1) == true)
                {
                }
                else
                {
                    mAutoPickCoroutine = SafeCoroutine.CoroutineManager.StartCoroutine(AutoPickCoroutine());
                }
            }
        }

        InstanceDropManager.GetInstance().AddDrop(this);
    }