Пример #1
0
 void  OnTriggerEnter(Collider other)
 {
     if (other.tag.Equals("Coin") || other.tag.Equals("COLLECTION"))
     {
         WGGameWorld.Instance.HideObj(other.gameObject);
         if (bMissSound)
         {
             BCSoundPlayer.Play(MusicEnum.noHit);
         }
         if (bCheckAchievement)
         {
             BCGameObj obj = other.GetComponent <BCGameObj>();
             WGAchievementManager.Self.processAchievement(obj.ID, DTAchievementType.LOST_OBJ);
         }
         if (bChechHelpState)
         {
             if (WGHelpManager.Self != null && WGHelpManager.Self.enabled)
             {
                 if (!WGHelpManager.Self.StatesIsEnd(EMHelpStates.Miss_Coin))
                 {
                     Time.timeScale = 0;
                     WGHelpManager.Self.ShowHelpView(EMHelpStates.Miss_Coin);
                 }
             }
         }
     }
 }
Пример #2
0
 public void HideObj(GameObject g, float time)
 {
     if (_szLiveCoin.Contains(g))
     {
         _szLiveCoin.Remove(g);
         BCGameObj bcg = g.GetComponent <BCGameObj>();
         if (bcg != null)
         {
             BCGameObjectType tp = WGDataController.Instance.GetBCObjType(bcg.ID);
             if (tp == BCGameObjectType.Collection)
             {
                 _szDeskCollection[bcg.ID - 3000]--;
             }
         }
     }
     Destroy(g, time);
 }
Пример #3
0
    //创建游戏物体工厂
    public GameObject BCGameObjFactory(int id, Vector3 po, Vector3 ro, Vector3 scale)
    {
        BCObj mObj = WGDataController.Instance.GetBCObj(id);

        switch (mObj.BCType)
        {
        case BCGameObjectType.Bear:
        {
            _Obj = Instantiate(mObj.goRes, po, Quaternion.Euler(ro)) as GameObject;
            _Obj.transform.localScale = Vector3.one * 0.8f;
        }
        break;

        case BCGameObjectType.ExpCoin:
        case BCGameObjectType.Item:
        case BCGameObjectType.Coin:
        {
            _Obj = Instantiate(mObj.goRes) as GameObject;

            _Obj.transform.parent = _BearCoinRoot.transform;

            _Obj.transform.position = po;
            _Obj.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 180));
            _Obj.SetActive(true);

            _Obj.GetComponent <Rigidbody>().velocity        = Vector3.zero;
            _Obj.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;

            Vector3 ls = Vector3.one;
            if (Core.fc.dicCoinScale.ContainsKey(mObj.ID))
            {
                ls = Core.fc.dicCoinScale[mObj.ID];
            }
            else
            {
                switch (id)
                {
                case WGDefine.Value100Coin:
                    ls   = ls * 0.7f;
                    ls.y = 0.9f;
                    break;

                case WGDefine.Value10Coin:
                    ls   = ls * 0.55f;
                    ls.y = 0.75f;
                    break;

                case WGDefine.Value5Coin:
                case WGDefine.Value3Coin:
                case WGDefine.Value2Coin:
                    ls   = ls * 0.434f;
                    ls.y = 0.634f;
                    break;

                case WGDefine.CommonCoin:
                    ls   = ls * 0.4f;
                    ls.y = 0.6f;
                    break;

                default:
                    ls   = ls * 0.5f;
                    ls.y = 0.6f;
                    break;
                }
            }

            _Obj.transform.localScale = ls;

            _CoinProperty = _Obj.GetComponent <BCGameObj>();
            _CoinProperty.freshWithData(mObj);

            _szLiveCoin.Add(_Obj);
        }

        break;

        case BCGameObjectType.Jewel:        // 宝石

            break;

        case BCGameObjectType.Collection:
            _Obj = Instantiate(mObj.goRes, po, Quaternion.Euler(new Vector3(270, 0, 0))) as GameObject;
            _Obj.transform.parent = _BearCoinRoot.transform;
//			_Obj.transform.localScale = Vector3.one*0.6f;

            _CoinProperty = _Obj.GetComponent <BCGameObj>();
            _CoinProperty.freshWithData(mObj);
            _szDeskCollection[id - 3000]++;

            _szLiveCoin.Add(_Obj);

            break;
        }

        return(_Obj);
    }
Пример #4
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);
    }
    public void OnApplicationPause(bool pause)
    {
        if (pause)
        {
                        #if Add_AD
            if (DataPlayerController.getInstance().data.DelAD == 0)
            {
                IOSAD.showInterstitialMoGo();
            }
                        #endif

            DataPlayerController.getInstance().saveDataPlayer();

                        #if UNITY_IPHONE || UNITY_IOS
            System.DateTime today = System.DateTime.Now;


            int canGotNum = Mathf.Max(WGConfig.AUTO_ADD_MAX - _DataPlayer.Coin, 0) / 10;
            if (canGotNum > 0)
            {
                for (int i = 0; i < canGotNum; i++)
                {
                    LocalNotification ln = new LocalNotification();
                    ln.applicationIconBadgeNumber = (i + 1) * 10;

                    System.DateTime answer = today.AddSeconds((i + 1) * 60);

                    ln.fireDate = answer;

                    NotificationServices.ScheduleLocalNotification(ln);
                }
            }

            today = System.DateTime.Now;

            int hour = 24 - today.Hour;
            int min  = 10 + 60 - today.Minute;


            LocalNotification ln1 = new LocalNotification();
            ln1.alertBody   = WGStrings.getText(1036);
            ln1.alertAction = WGStrings.getText(1037);
            ln1.hasAction   = true;
            ln1.fireDate    = today.Add(new System.TimeSpan(hour, min, 0));
            ln1.soundName   = LocalNotification.defaultSoundName;

            NotificationServices.ScheduleLocalNotification(ln1);
                        #endif

            MDDataCoin dc = DataCoinController.getInstance().data;

            dc.CoinID.Clear();
            dc.CoinPos.Clear();
            dc.CoinRoto.Clear();
            for (int i = 0, max = cs_ObjManager._szLiveCoin.Count; i < max; i++)
            {
                BCGameObj go = cs_ObjManager._szLiveCoin[i].GetComponent <BCGameObj>();
                dc.CoinID.Add(go.ID);
                dc.CoinPos.Add(SDK.to3Float(go.transform.position));
                dc.CoinRoto.Add(SDK.to3Float(go.transform.localEulerAngles));
            }
            DataCoinController.getInstance().saveDataCoin();

#if TalkingData
//			int[] szDa = new int[]{10000,90000,80000,70000,60000,50000,40000,30000,20000,10000,8000,6000,4000,2000,};
//			Dictionary<string, object> dic = new Dictionary<string, object>();
//			if(mGotCoinNum>100000)
//			{
//				dic.Add("getCoinNum", "10w");
//
//			}
//			else if(mGotCoinNum>90000)
//			{
//				dic.Add("getCoinNum","9w_10w");
//			}
//			else if(mGotCoinNum>80000)
//			{
//				dic.Add("getCoinNum","8w_9w");
//			}
////			else if(mGotCoinNum>
//			TalkingDataGA.OnEvent(WGStrings.getText(9001), dic);
#endif
        }
        else
        {
                        #if Add_AD
            if (DataPlayerController.getInstance().data.DelAD == 0)
            {
                IOSAD.readyInterstitialAds();
            }
                        #endif
            mGotCoinNum = 0;
            CleanNotification();
            CheckDefenseTime();
        }
    }
Пример #6
0
    void Throw()
    {
        if (!_ShareWorld.cs_BearManage.bHaiXiaoEffect)
        {
            _Weapon.FireEffect();
            int subNum = -10;
            if (_weaponData != null)
            {
                subNum = -_weaponData.cost;
            }
//			if(_weaponData.cost>dp.Coin)
//			{
//				if(mWeaponIndex>Consts.WEAPON_MIN)
//				{
//					mWeaponIndex = GetCanThrowIndex();
//					changeWeapon();
//					subNum = -_weaponData.cost;
//					return;
//				}
//
//			}
            if (!_ShareWorld.PlayerGetCoin(subNum))
            {
                if (!_ShareWorld.bNoCoinTip)
                {
//					_ShareWorld.bNoCoinTip = true;
                    _ShareWorld.NoCoinTipCan();

                    _ShareWorld.ShowCoinSupplementView();
                }
                return;
            }
        }
        BCSoundPlayer.Play(MusicEnum.Shot);
        if (bUseStaticWeapon)
        {
            Vector3 cur = Input.mousePosition - new Vector3(Screen.width / 2, 0, 0);

            float mm = Vector3.Angle(Vector3.up, cur);

            if (mm > 15)
            {
                mm = 15;
            }

            if (cur.x <= 0)
            {
                mm = -mm;
            }

            Ro = mm;



            _Weapon.trBullet.enabled = false;
            Vector3 temp = _Weapon.tRote.localEulerAngles;
            temp.y = Ro;
            _Weapon.tRote.localEulerAngles = temp;


            if (Ro > 300)
            {
                Ro = Ro - 360;
            }
            Ro /= 15;
        }
        else
        {
            Ro = _Weapon.tRote.localEulerAngles.y;
//			Debug.Log(Ro);
            if (Ro > 300)
            {
                Ro = Ro - 360;
            }
            Ro /= 15;
        }
        _Coin = WGGameWorld.Instance.cs_ObjManager.BCGameObjFactory(_weaponData.oid, _Weapon.tBullet.position, Vector3.zero, Vector3.one);
//		_Coin =  Instantiate(_Weapon.goBullet,_Weapon.tBullet.position,Quaternion.Euler(Vector3.zero)) as GameObject;
//		_Coin.transform.parent = WGBearManage.Instance.ThrowCoinRoot.transform;



        _Rig = _Coin.GetComponent <Rigidbody>();

        Vector3 v3force = new Vector3(Ro, Up, Forward);

        _Rig.AddForce(v3force, ForceMode.Impulse);

        _bullet = _Coin.AddComponent <WGBullet>();

        _bullet.mAct = _weaponData.hurt;
        if (dp.mR == 1)
        {
//			if(dp.r == 0)
//			{
//				_bullet.mAct = (int)(_weaponData.hurt *1.1f);
//			}
//			else if(dp.r == 1)
            {
                _bullet.mAct = (int)(_weaponData.hurt * 1.3f);
            }
        }

        BCObj bco = WGDataController.Instance.GetBCObj(_weaponData.oid);

        BCGameObj bcgo = _Coin.GetComponent <BCGameObj>();

        bcgo.freshWithData(bco);
    }