コード例 #1
0
    //生成分数,还需要生成文字perfect提示
    void ScoreGenerate()
    {
        if (!scoreGenerating)
        {
            scoreGenerating = true;
            Invoke("ResetScoreGenerate", 1);
            //如果没有踩中环,弹出MISS并拳头打飞
            string ringname = CheckRing();
            if (ringname == "normal" && GameState != 0)
            {
                //GameState = 0;
                //rings.Clear ();
                //if (tempText) {
                //	TipPop.GenerateTip ("X1", 0.5f,Color.yellow);
                //	int coinLevel = PlayerPrefs.GetInt ("coinLevel", 1);
                //	Gold.Instance.GetGold ((int)(77*(Mathf.Pow(1.05f,coinLevel))));
                //	MoneyManager.Instance.UpdateGold ();
                Destroy(tempText, 0.5f);
                if (PlayerPrefs.GetInt("vibration", 1) == 1)
                {
                    MultiHaptic.HapticMedium();
                }
                //TipPop.GenerateTip ("MISS", 0.5f);
                GameOverByBoxglove(currentColl);

                FlyGold.Instance.GenerateGoldNoColl(30, transform.position + Vector3.up * 2);
                //TipPop.GenerateTip ("-$"+curGold, 0.5f,Color.yellow);
                //}
                return;
            }
            else
            {
                //踩中环的时候状态变为待机状态,生成对应的分数,删除踩中的环
                GameState = 0;

                Transform ringTrans = Instantiate(currentRing [ringname + "(Clone)"].gameObject).transform;
                ringTrans.DOScale(ringTrans.localScale * 3, 0.5f);
                MeshRenderer ringMesh = ringTrans.GetComponent <MeshRenderer> ();
                ringMesh.material = ringMarDic [ringname];
                ringMesh.material.DOColor(Color.clear, 0.5f).OnComplete(() => {
                    Destroy(ringTrans.gameObject);
                });

                rings.Clear();
                if (PlayerPrefs.GetInt("vibration", 1) == 1)
                {
                    MultiHaptic.HapticMedium();
                }
                if (tempText)
                {
                    TipPop.GenerateTip("X" + scoreDic [ringname], 0.5f, Color.yellow);
                    Destroy(tempText, 0.5f);
                    //int coinLevel = PlayerPrefs.GetInt ("coinLevel", 1);
                    Gold.Instance.GetGold((int)(curGold * scoreDic [ringname]));
                    MoneyManager.Instance.UpdateGold();
                }
                TipPop.GenerateTipPerfect(perfectWord [Random.Range(0, perfectWord.Length)], 1f, Color.yellow);
            }
        }
    }
コード例 #2
0
 //点击人物选择
 public void OnSelectBtn(int index)
 {
     if (PlayerPrefs.GetInt("curLevel" + index, 0) > 0)
     {
         PlayerPrefs.SetInt("curSelect", index);
         UpdateSelect();
     }
     else
     {
         TipPop.GenerateTip("Not unlocked", 0.5f);
     }
 }
コード例 #3
0
 public void OnFreeReGameBtn()
 {
     if (TGSDK.CouldShowAd(TGSDKManager.resetLevelID))
     {
         TGSDK.ShowAd(TGSDKManager.resetLevelID);
         TGSDK.AdCloseCallback = (string obj) => {
             gameStartScript.ChangeLevel();
         };
     }
     else
     {
         TipPop.GenerateTip("no ads", 0.5f);
     }
 }
コード例 #4
0
 //看广告免费得钻石
 public void OnFreeBtn()
 {
     if (TGSDK.CouldShowAd(TGSDKManager.freeDiamondId))
     {
         TGSDK.ShowAd(TGSDKManager.freeDiamondId);
         TGSDK.AdCloseCallback = (string obj) => {
             Diamond.Instance.GetDiamond(25);
             MoneyManager.Instance.UpdateDiamond();
         };
     }
     else
     {
         TipPop.GenerateTip("no ads", 0.5f);
     }
 }
コード例 #5
0
 public void OnFreeMissionBtn()
 {
     if (TGSDK.CouldShowAd(TGSDKManager.resetDailyID))
     {
         TGSDK.ShowAd(TGSDKManager.resetDailyID);
         TGSDK.AdCloseCallback = (string obj) => {
             PlayerPrefs.SetInt("freeMission", 1);
             UpdateMission();
         };
     }
     else
     {
         TipPop.GenerateTip("no ads", 1f);
     }
 }
コード例 #6
0
    //使用金币,更新UI及存储,不够则弹出提示,返回购买状态
    public bool UseGold(int number)
    {
        int curGold = PlayerPrefs.GetInt("Gold", 0);

        if (curGold >= number)
        {
            curGold  -= number;
            gold.text = curGold.ToString();
            PlayerPrefs.SetInt("Gold", curGold);
            return(true);
        }
        else
        {
            TipPop.GenerateTip("Not enough Gold", 1f, Color.black);
            return(false);
        }
    }
コード例 #7
0
    //使用钻石,更新UI及存储,不够则弹出提示,返回购买状态
    public bool UseDiamond(int number)
    {
        int curDiamond = PlayerPrefs.GetInt("diamond", 0);

        if (curDiamond >= number)
        {
            curDiamond  -= number;
            diamond.text = curDiamond.ToString();
            PlayerPrefs.SetInt("diamond", curDiamond);
            return(true);
        }
        else
        {
            TipPop.GenerateTip("Not enough diamonds", 1f);
            return(false);
        }
    }
コード例 #8
0
    //使用金币,更新UI及存储,不够则弹出提示,返回购买状态
    public bool UseGold(int number)
    {
        int curGold = PlayerPrefs.GetInt("gold", 0);

        if (curGold >= number)
        {
            curGold  -= number;
            gold.text = "$ " + curGold;
            PlayerPrefs.SetInt("gold", curGold);
            return(true);
        }
        else
        {
            TipPop.GenerateTip("Not enough Gold", 1f);
            return(false);
        }
    }
コード例 #9
0
 public void OnDoubleBtn()
 {
     if (TGSDK.CouldShowAd(TGSDKManager.doubleID))
     {
         TGSDK.ShowAd(TGSDKManager.doubleID);
         TGSDK.AdCloseCallback = (string obj) => {
             FlyGold.Instance.GenerateGoldNoColl(20, player.position);
             Gold.Instance.GetGold(passGold);
             MoneyManager.Instance.UpdateGold();
             Time.timeScale = 1;
         };
     }
     else
     {
         TipPop.GenerateTip("no ads", 1f);
         OnExitBtn();
     }
 }
コード例 #10
0
 //先看广告再转转盘
 public void OnTurnBtn()
 {
     if (PlayerPrefs.GetInt("TurnHomeFinish", 0) == 1)
     {
         return;
     }
     if (TGSDK.CouldShowAd(TGSDKManager.turnID))
     {
         TGSDK.ShowAd(TGSDKManager.turnID);
         TGSDK.AdCloseCallback = (string obj) => {
             turnTable.SetActive(true);
         };
     }
     else
     {
         TipPop.GenerateTip("no ads", 1);
     }
 }
コード例 #11
0
	public void OnStartBtn(){
		skill.gameObject.SetActive (false);
		personAnimator.avatar = null;
		onAir = true;
		personAnimator.runtimeAnimatorController = throwPlane;
		//Invoke ("Shootplane", (5/6f/1.7f));
		float levelAddtion = 1 + ((PlayerPrefs.GetInt ("level", 1) - 1) * 3) / 100f;
		StartCoroutine (CheckVelociy ());
		StartCoroutine (CorrectionPlane());
		MultiHaptic.HapticHeavy ();
		pointer.StopPoint ();
		//transform.eulerAngles = new Vector3 (10, shootRotation, 0);
		if (shootForce >= 0.88f) {
			TipPop.GenerateTip (perfectWords [Random.Range (0, 4)], 0.5f);
			StartCoroutine (PerfectShoot ());
			Invoke ("Shootplane", (5/6f/1.8f));
			perfectAdd = 1.5f;
		} else {
			if (shootForce <= 0.4f) {
				//TipPop.GenerateTip (badWords [Random.Range (0, 4)], 0.5f);
				perfectAdd = -0.5f;
			} else {
				TipPop.GenerateTip (goodWords [Random.Range (0, 4)], 0.5f);
			}
			Invoke ("Shootplane", (5/6f/1.7f));
			//StartCoroutine (NormalParticle ());
			//personPlane.DOPunchScale(personPlane.localScale*2,0.5f,10,1);
		}

		float perfectTime = (PlayerPrefs.GetInt ("power_level", 0)) * 0.6f *3 * levelAddtion;
		if (shootForce <= 0.43f) {
			perfectTime *= shootForce / 0.43f * 0.5f + 0.5f;
		} else {
			perfectTime *= (shootForce-0.43f) / (1 - 0.43f) * 0.5f + 1;
		}
		StartCoroutine (GravityVary (0.4f+perfectTime+perfectAdd));
		StartCoroutine (StopTimeScale ((0.4f + perfectTime + perfectAdd) * 0.8f+1.7f));
		Invoke ("CameraStartRotate", 2);
	}
コード例 #12
0
    IEnumerator GenerateGoldByFlip(int flipnumber, float time)
    {
        curGold = 0;
        float timeDu    = time / (flipnumber + 1);
        int   coinLevel = PlayerPrefs.GetInt("coinLevel", 1);
        int   curAction = (PlayerPrefs.GetInt("curSelect", 0)) * 2 + 1;
        int   getGold   = ((int)(77 * (Mathf.Pow(1.05f, coinLevel)))) * curAction;

        yield return(new WaitForSeconds(timeDu / 5));

        for (int i = 0; i < flipnumber + 1; i++)
        {
            if (tempText)
            {
                Destroy(tempText);
            }
            getGold = (int)(getGold * (i * 0.2f + 1));
            TipPop.GenerateTipStay("$" + getGold, 0.5f, Color.white);
            FlyGold.Instance.GenerateGoldNoColl(20, transform.position);
            curGold = getGold;
            yield return(new WaitForSeconds(timeDu - (flipnumber - i) * timeDu / 10));
        }
        //curGold = getGold;
    }
コード例 #13
0
    //碰撞处理
    //跳跃状态才能碰撞
    //撞到一般物体加少量分数,若超过目标点则生成新的目标点,进入待机状态,生成分数
    //身体先发生碰撞则判定死亡
    private void OnCollisionEnter(Collision coll)
    {
        //离开黑洞后状态为进入新关卡,此时若碰到一般建筑则...
        if (GameState == 7 && coll.collider.tag == "Untagged")
        {
            transform.position = targetStartPos.position;
            rig.constraints    = RigidbodyConstraints.FreezeAll;
            //状态变为待机,播放待机动画
            GameState = 0;
            animator.SetBool("Idle", true);
            SetJumpBool(false);
            //如果是进入新关卡则增加关卡数并刷新关卡UI
            if (Level.Instance.slider.value == 1)
            {
                int curMapIndex = PlayerPrefs.GetInt("CurMap", 0);
                PlayerPrefs.SetInt("Level" + curMapIndex, PlayerPrefs.GetInt("Level" + curMapIndex, 1) + 1);
                Level.Instance.UpdateLevel();

                if (PlayerPrefs.GetInt("Level" + curMapIndex, 1) >= 10 && PlayerPrefs.GetInt("TurnHomeFinish", 0) == 0)
                {
                    TurntableGuide.Instance.StartGuide();
                }
                if (PlayerPrefs.GetInt("Level" + curMapIndex, 1) >= 20 && PlayerPrefs.GetInt("MapHomeFinish", 0) == 0)
                {
                    MapGuide.Instance.StartGuide();
                }
                if (PlayerPrefs.GetInt("SkillFinish", 0) == 0)
                {
                    int gold     = PlayerPrefs.GetInt("Gold", 0);
                    int needGold = PlayerPrefs.GetInt("SkillGold0", 281);
                    if (needGold == 281)
                    {
                        if (gold >= needGold)
                        {
                            SkillGuide.Instance.StartGuide();
                        }
                    }
                    else
                    {
                        PlayerPrefs.SetInt("SkillFinish", 1);
                    }
                }
            }
            //生成新环
            RadarScan();
            //显示关卡UI
            HideGameUI(false);
            HideMoneyUI(false);

            if (tempText)
            {
                TipPop.GenerateTip("X5", 0.7f, Color.yellow);
                Destroy(tempText, 0.5f);
                PlayerPrefs.SetInt("LevelPassGold", curGold * 5);
                Gold.Instance.GetGold(curGold * 5);
                MoneyManager.Instance.UpdateGold();
                couldShowDoubl = true;
                TipPop.GenerateTipPerfect("level up", 1f, Color.yellow);
            }
        }

        //如果是跳跃状态
        if (GameState == 2)
        {
            //如果碰到了一般建筑
            if (coll.collider.tag == "Untagged")
            {
                float playerEulerX = transform.eulerAngles.x;
                //if((eulurX%360)>=295&&(eulurX%360)<=360){
                //if ((playerEulerX > 325 && playerEulerX < 360) || (playerEulerX > 0 && playerEulerX < 50)) {
                //获得当前碰撞的点
                currentColl = coll.contacts [0].point;
                //检查射线下是否有环
                CheckRingByRay();
                //等待一段时间根据环生成分数,生成新的环
                Invoke("ScoreGenerate", 0.05f);
                Invoke("GenerateNewRing", 0.1f);
                //一段时间后锁定主角
                rig.constraints = RigidbodyConstraints.FreezeAll;

                //} else {
                //	GameOverByBoxglove (currentColl);
                //	TipPop.GenerateTip ("MISS", 0.5f);
                //GameOverByBoxglove (transform.position + new Vector3 (0, -5, 0));
                //}
            }
        }

        //如果蓄力过度则被拳头打飞
        if (GameState == 10)
        {
            //GameOverByBoxglove (transform.position + new Vector3 (0, -5, 0));
        }

        //如果被车撞了,状态变为被车撞,解除主角限制,往被撞的方向施加力,给予主角随机旋转,三秒后重开游戏
        if (coll.collider.tag == "car" && GameState != 9)
        {
            isRotate = false;
            HidePower(true);
            GameState       = 9;
            rig.constraints = RigidbodyConstraints.None;
            Vector3 carDirection = (transform.position - coll.transform.position).normalized;
            rig.AddForce((carDirection + transform.up) * carForce, ForceMode.Force);
            Instantiate(hitPs, transform.position + new Vector3(0, 3, 0), Quaternion.identity);
            transform.DOLocalRotate(new Vector3(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360)), 1.5f, RotateMode.LocalAxisAdd);
            Invoke("ReGame", 3);
            PlayerPrefs.SetInt("CarHit", PlayerPrefs.GetInt("CarHit", 0) + 1);
            if (PlayerPrefs.GetInt("vibration", 1) == 1)
            {
                MultiHaptic.HapticHeavy();
            }
            if (tempText)
            {
                Destroy(tempText);
            }
            dailyTimes++;
            if (dailyTimes >= 3)
            {
                Invoke("ShowDaily", 3);
            }
        }
    }