예제 #1
0
 public static V2CoinDropEffect CreateDropEffect()
 {
     if (mObj == null)
     {
         mObj = Resources.Load("pbAddCoin");
     }
     if (mObj != null)
     {
         GameObject       go = Instantiate(mObj) as GameObject;
         V2CoinDropEffect cd = go.GetComponent <V2CoinDropEffect>();
         return(cd);
     }
     return(null);
 }
예제 #2
0
    public void ProcessDropObj()
    {
        if (DropQueue == null)
        {
            return;
        }
        if (DropQueue.Count == 0)
        {
            return;
        }
        GameObject go = DropQueue.Dequeue();

        if (go == null)
        {
            return;
        }
        BCGameObj tem = go.GetComponent <BCGameObj>();

        if (tem == null)
        {
            HideObj(go);
            return;
        }

        CancelInvoke("GotCoinEnd");
        Invoke("GotCoinEnd", 0.2f);

        if (!bPlayGotCoin)
        {
            bPlayGotCoin = true;
            InvokeRepeating("GotCoinSound", 0.1f, 0.15f);
        }

        WGAchievementManager.Self.processAchievement(tem.ID, DTAchievementType.GOT_COIN, tem.Value);
//		PlayerGetCoin(tem.Value);

        if (tem.Value > 0)
        {
            V2CoinDropEffect cd = V2CoinDropEffect.CreateDropEffect();
            cd.labCoinNum.text    = "+" + tem.Value.ToString();
            cd.transform.parent   = cs_BearManage.go3DUIFrontPanel.transform;
            cd.transform.position = go.transform.position;



//			GameObject goAdd = Instantiate(goAddCoin) as GameObject;
//			UILabel lab = goAdd.GetComponent<UILabel>();
//			lab.text = "+"+tem.Value.ToString();
//			goAdd.transform.parent = cs_BearManage.go3DUIFrontPanel.transform;
//			goAdd.transform.position = go.transform.position;

            Vector3 v3temp = cd.transform.localPosition;            // goAdd.transform.localPosition;

            v3temp.z = -10f;
            v3temp.y = -1.4f;

            cd.transform.localPosition = v3temp;
            TweenPosition tp = cd.tpContent;            // goAdd.GetComponent<TweenPosition>();

            tp.from = v3temp;
            tp.to   = new Vector3(v3temp.x, Random.Range(3, 7), v3temp.z);

            _mAddCoinNum2 += tem.Value;

            CancelInvoke("IGotCoin");
            Invoke("IGotCoin", 0.5f);
        }
        WGAchievementManager.Self.processAchievement(tem.ID, DTAchievementType.DROP_OBJ);
        PlayGetExp(tem.Exp);



        if (tem.Type == 1)
        {
            if (_mAddCoinNum == 0)
            {
                _FristDropTime = Time.time;
                _LastDropTime  = Time.time;
                dropCount++;
                _mAddCoinNum += tem.Value;
            }
            else
            {
                if (_LastDropTime - _FristDropTime < DeltaTime)
                {
                    _LastDropTime = Time.time;
                    dropCount++;
                    _mAddCoinNum += tem.Value;
                }
            }
        }



        float delt = 0;

        switch (tem.Type)
        {
        case 1:              //金币
            if (WGHelpManager.Self != null)
            {
                bool show = false;
                if (!show && !WGHelpManager.Self.StatesIsEnd(EMHelpStates.Drop_Coin))
                {
                    show           = true;
                    Time.timeScale = 0;
                    WGHelpManager.Self.ShowHelpView(EMHelpStates.Drop_Coin);
                }
            }
            break;

        case 2:          //道具币
            qReleaseSkillQueue.Enqueue(tem.ID);

            break;

        case 3:          //收藏品
            qDropCollection.Enqueue(tem.ID);
            WGAchievementManager.Self.processAchievement(tem.ID, DTAchievementType.GOT_ITEM);
            WGAchievementManager.Self.processAchievement(tem.ID, DTAchievementType.GOT_ITEM_GROUP);
            PlayerGetCollection(tem.ID);
            delt = 2;
            break;
        }
        HideObj(go, delt);
    }