コード例 #1
0
    public void OnDepthClick()
    {
        gold = PlayerPrefs.GetInt("gold", 0);
        if (gold > price)
        {
            MultiHaptic.HapticMedium();
            gold -= price;
            UIManager.Instance.diveDepth -= 7;
            price = (int)(price * 1.35f);

            if (PlayerPrefs.GetInt("Level", 1) == 1)
            {
                PlayerPrefs.SetInt("valueDepth", UIManager.Instance.diveDepth);
                PlayerPrefs.SetInt("priceDepth", price);
            }
            else if (PlayerPrefs.GetInt("Level", 1) == 2)
            {
                PlayerPrefs.SetInt("valueDepth2", UIManager.Instance.diveDepth);
                PlayerPrefs.SetInt("priceDepth2", price);
            }
            else if (PlayerPrefs.GetInt("Level", 1) == 3)
            {
                PlayerPrefs.SetInt("valueDepth3", UIManager.Instance.diveDepth);
                PlayerPrefs.SetInt("priceDepth3", price);
            }

            PlayerPrefs.SetInt("gold", gold);
            UpdateData(0);
            CheckGold();
        }
    }
コード例 #2
0
 public void OnButtonClick()
 {
     if (PlayerPrefs.GetInt("vibration", 1) == 1)
     {
         MultiHaptic.HapticLight();
     }
 }
コード例 #3
0
    public void OnOfflineClick()
    {
        gold = PlayerPrefs.GetInt("gold", 0);
        if (gold > price)
        {
            MultiHaptic.HapticMedium();
            gold -= price;

            if (UIManager.Instance.offlineGold < 400)
            {
                UIManager.Instance.offlineGold += 40;
            }
            else
            {
                UIManager.Instance.offlineGold = (int)(UIManager.Instance.offlineGold * 1.25f);
            }

            price = (int)(price * 1.25f);
            PlayerPrefs.SetInt("valueOffline", UIManager.Instance.offlineGold);
            PlayerPrefs.SetInt("priceOffline", price);
            PlayerPrefs.SetInt("gold", gold);
            UpdateData(0);
            CheckGold();
        }
    }
コード例 #4
0
 IEnumerator CheckFingerMove()
 {
     while (true)
     {
         if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
         {
             Vector2 touchDelPos = Input.GetTouch(0).deltaPosition;
             if (touchDelPos.x > 7)
             {
                 RotateCy(false);
                 if (PlayerPrefs.GetInt("vibration", 1) == 1)
                 {
                     MultiHaptic.HapticLight();
                 }
                 yield return(new WaitForSeconds(0.3f));
             }
             else if (touchDelPos.x < -7)
             {
                 RotateCy(true);
                 if (PlayerPrefs.GetInt("vibration", 1) == 1)
                 {
                     MultiHaptic.HapticLight();
                 }
                 yield return(new WaitForSeconds(0.3f));
             }
         }
         yield return(null);
     }
 }
コード例 #5
0
 public void OnButtonClick()
 {
     MultiHaptic.HapticMedium();
     transform.DOScale(1.1f, 0.15f).OnComplete(() => {
         transform.DOScale(1f, 0.15f);
     }).SetEase(Ease.InBack);
 }
コード例 #6
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);
            }
        }
    }
コード例 #7
0
	//飞机旋转
	IEnumerator AddPlaneSpeed(){	
		if (onAir) {				
			MultiHaptic.HapticHeavy ();
			transform.DORotate (new Vector3 (12, transform.eulerAngles.y, transform.eulerAngles.z), 1f, RotateMode.Fast);
			flipDiamond = true;
			Physics.gravity = new Vector3 (0, 0, 0);
			while (true) {				
				rig.velocity = Vector3.Lerp (rig.velocity, new Vector3 (rig.velocity.x, 2, rig.velocity.z), Time.deltaTime * 8);
				if (Vector3.Distance (rig.velocity, new Vector3 (rig.velocity.x, 2, rig.velocity.z)) < 0.5f) {
					yield return new WaitForSeconds (0.5f);
					rig.velocity = new Vector3 (rig.velocity.x, 0, rig.velocity.z);
					float flipTime = 1;
					if (shootForce <= 0.43f) {
						flipTime *= shootForce / 0.43f * 0.5f + 0.5f;
					} else {
						flipTime *= (shootForce-0.43f) / (1 - 0.43f) * 0.5f + 1;
					}
					yield return new WaitForSeconds ((PlayerPrefs.GetInt ("flip_level", 0))*0.3f*3*flipTime+perfectAdd);
					flipDiamond = false;
					break;
				}
				yield return null;
			}
		}
		Physics.gravity = new Vector3 (0, -3, 0);
		addPlaneSpeedSwitch = false;

	}
コード例 #8
0
 public void OnLevel3Btn()
 {
     if (PlayerPrefs.GetInt("Lock3", 0) == 1)
     {
         int level = PlayerPrefs.GetInt("Level", 1);
         if (level != 3)
         {
             MultiHaptic.HapticMedium();
             int       index    = int.Parse((levelPos [level - 1].name.ToString()));
             int       curIndex = int.Parse((levelPos [2].name.ToString()));
             int       v3Count;
             Vector3[] pathV3;
             if (curIndex > index)
             {
                 v3Count = curIndex - index + 1;
                 pathV3  = new Vector3[v3Count];
                 for (int i = 0; i < v3Count; i++)
                 {
                     pathV3 [i] = pathPoint [index + i - 1].position;
                 }
             }
             else
             {
                 v3Count = index - curIndex + 1;
                 pathV3  = new Vector3[v3Count];
                 for (int i = 0; i < v3Count; i++)
                 {
                     pathV3 [i] = pathPoint [index - i].position;
                 }
             }
             Destroy(point.gameObject);
             shipMark.DOPath(pathV3, 1, PathType.Linear, PathMode.TopDown2D, 10, null).OnComplete(() => {
                 PlayerPrefs.SetInt("Level", 3);
                 SceneManager.LoadScene("Level3");
             });
         }
     }
     else
     {
         int cost = 300000000;
         MessageBox.Show("", "It costs " + "$300,000K" + "to unlock", 2);
         MessageBox.confim = () => {
             int gold = PlayerPrefs.GetInt("gold", 0);
             if (gold > cost)
             {
                 gold -= cost;
                 PlayerPrefs.SetInt("gold", gold);
                 UIManager.Instance.goldT.DOText(UIManager.UnitChange(gold), 0.5f, false, ScrambleMode.None, null);
                 Upgrading.Instance.CheckGold();
                 UpgradingOffline.Instance.CheckGold();
                 PlayerPrefs.SetInt("Lock3", 1);
                 transform.Find("Level3").Find("lock").gameObject.SetActive(false);
             }
             else
             {
                 GenerateText(lv4, "Not enough money!");
             }
         };
     }
 }
コード例 #9
0
        public static void Double()
        {
            MultiHaptic.HapticMedium();
            if (Messagebox.tag == "PopBG")
            {
                if (doubleR != null)
                {
                    doubleR();
                    GameObject.Destroy(Messagebox);
                }
            }
            if (Messagebox.tag == "PurchasePop")
            {
                if (cancle != null)
                {
                    cancle();
                }
                GameObject.Destroy(Messagebox);
            }
//			Result = 2;
//			GameObject.Destroy(Messagebox);
//			TitleStr = "标题";
//			ContentStr = null;
            //Time.timeScale = 1;
        }
コード例 #10
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Fish" || collider.tag == "unusual")
     {
         if (!ProgressManager.Instance.isOvering && !ProgressManager.Instance.isReady)
         {
             if (collider.tag == "unusual")
             {
                 MultiHaptic.HapticHeavy();
                 //ScoreGenerate (collider.transform);
                 collider.GetComponent <GhostSprites> ().alphaFluctuationOverride = 0.15f;
                 //Destroy( collider.GetComponent<GhostSprites> ());
             }
             if (ProgressManager.Instance.isRunning)
             {
                 MultiHaptic.HapticLight();
                 ScoreGenerate(collider.transform, new Vector3(0, 200, 0));
                 collider.transform.position = new Vector3(transform.position.x + Random.Range(-0.8f, 0.8f), transform.position.y + 0.2f + Random.Range(-0.5f, 0.4f), 0.5f);
                 collider.transform.SetParent(transform);
             }
             else if (ProgressManager.Instance.isOver)
             {
                 MultiHaptic.HapticLight();
                 ScoreGenerate(collider.transform, new Vector3(0, 0, 0));
                 collider.transform.position = new Vector3(transform.position.x + Random.Range(-0.8f, 0.8f), transform.position.y - 0.4f + Random.Range(0.4f, 0.9f), 0.5f);
                 collider.transform.SetParent(transform);
             }
         }
     }
 }
コード例 #11
0
 public void OnBackBtnClick()
 {
     if (isShow)
     {
         MultiHaptic.HapticMedium();
         illustration.DOMoveY(illustration.position.y + screenHeight, 0.5f, false);
         isShow = false;
     }
 }
コード例 #12
0
 public void OnIllBtnClick()
 {
     if (!isShow)
     {
         MultiHaptic.HapticMedium();
         illustration.DOMoveY(illustration.position.y - screenHeight, 0.5f, false);
         isShow = true;
         illNew.SetActive(false);
         PlayerPrefs.SetInt("illNew", 0);
     }
 }
コード例 #13
0
 public static void Sure()
 {
     if (confim != null)
     {
         MultiHaptic.HapticMedium();
         confim();
         GameObject.Destroy(Messagebox);
         TitleStr   = "标题";
         ContentStr = null;
         //Time.timeScale = 1;
     }
 }
コード例 #14
0
    IEnumerator CheckFingerMove()
    {
        while (true)
        {
            if ((Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) || Input.GetKeyDown(KeyCode.Z))
            {
                if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
                {
                    Vector2 touchDelPos = Input.GetTouch(0).deltaPosition;
                    if (touchDelPos.x < -7)
                    {
                        shopScript.RotateCy(true);
                        finger.SetActive(false);
                        if (PlayerPrefs.GetInt("vibration", 1) == 1)
                        {
                            MultiHaptic.HapticLight();
                        }
                        yield return(new WaitForSeconds(0.3f));

                        point [0].SetActive(true);
                        bg.gameObject.SetActive(false);
                        GameObject buyGO = Instantiate(buy, bg);
                        buyGO.transform.Find("bg").GetComponent <Button> ().onClick.AddListener(() => {
                            Destroy(buyGO);
                            point [0].SetActive(false);
                        });
                        yield break;
                    }
                }
                else
                {
                    shopScript.RotateCy(true);
                    finger.SetActive(false);
                    if (PlayerPrefs.GetInt("vibration", 1) == 1)
                    {
                        MultiHaptic.HapticLight();
                    }
                    yield return(new WaitForSeconds(0.3f));

                    point [0].SetActive(true);
                    bg.gameObject.SetActive(false);
                    GameObject buyGO = Instantiate(buy, bg);
                    buyGO.transform.Find("bg").GetComponent <Button> ().onClick.AddListener(() => {
                        Destroy(buyGO);
                        point [0].SetActive(false);
                    });
                    yield break;
                }
            }
            yield return(null);
        }
    }
コード例 #15
0
	void OnCollisionEnter(Collision coll){
		StartCoroutine (StopPerfectTril ());
		useFlip = false;
		onAir = false;
		if (!settle.activeSelf) {
			isOver = true;
		}
		EndPlane ();
		//rig.constraints = RigidbodyConstraints.FreezeAll;
		//Physics.gravity = new Vector3 (0, -2, 0);
		MultiHaptic.HapticHeavy ();
		CameraRotate.Instance.target = realPlane;
		StartCoroutine (CheckGameover ());
	}
コード例 #16
0
    //被拳头打死
    void GameOverByBoxglove(Vector3 golvePos)
    {
        //在死亡状态或待机状态不作处理
        if (GameState == 3 || GameState == 0)
        {
            return;
        }
        isRotate = false;
        HidePower(true);
        //状态变为死亡状态,解放主角,被打方向施加力,随机旋转,三秒后重置游戏
        GameState       = 3;
        rig.constraints = RigidbodyConstraints.None;
        Vector3 carDirection = (transform.position - golvePos).normalized;

        rig.AddForce((carDirection + transform.up) * carForce, ForceMode.Force);
        Instantiate(hitPs, transform.position + new Vector3(0, 3, 0), Quaternion.identity);
        //rig.AddForce(Vector3.up* carForce*1.3f, ForceMode.Force);
        //transform.DOLocalRotate(new Vector3(Random.Range(0,360), Random.Range(0,360), Random.Range(0,360)), 0.2f, RotateMode.WorldAxisAdd);
        rig.AddTorque(new Vector3(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360)), ForceMode.Force);
        Invoke("ReGame", 3);
        //在主角位置生成拳套,面向主角出拳
        boxGloveTrans    = Instantiate(boxGlove, transform.position, Quaternion.identity).transform;
        boxGloveTrans.up = carDirection;
        //boxGloveTrans.up = Vector3.up;
        boxGloveTrans.DOMove(transform.position + Vector3.up * 3, 0.3f, false);
        //取消警告
        alarm.gameObject.SetActive(false);

        PlayerPrefs.SetInt("GloveHit", PlayerPrefs.GetInt("GloveHit", 0) + 1);

        if (tempText)
        {
            Destroy(tempText);
        }

        dailyTimes++;
        if (dailyTimes >= 3)
        {
            Invoke("ShowDaily", 3);
        }
        if (PlayerPrefs.GetInt("vibration", 1) == 1)
        {
            MultiHaptic.HapticHeavy();
        }
    }
コード例 #17
0
    public void OnLevel1Btn()
    {
        int level = PlayerPrefs.GetInt("Level", 1);

        if (level != 1)
        {
            MultiHaptic.HapticMedium();
            int       v3Count = int.Parse((levelPos [level - 1].name.ToString()));
            Vector3[] pathV3  = new Vector3[v3Count];
            for (int i = 0; i < v3Count; i++)
            {
                pathV3 [i] = pathPoint [v3Count - i - 1].position;
            }
            Destroy(point.gameObject);
            shipMark.DOPath(pathV3, 1, PathType.Linear, PathMode.TopDown2D, 10, null).OnComplete(() => {
                PlayerPrefs.SetInt("Level", 1);
                SceneManager.LoadScene("Level1");
            });
        }
    }
コード例 #18
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);
	}
コード例 #19
0
 public void onStartButton()
 {
     MultiHaptic.HapticMedium();
     isRunning = true;
     isReady   = false;
     SubmarineController.Instance.gravityScale = 2;
     if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
     {
         SubmarineController.Instance.moveSpeed = 1;
     }
     else
     {
         SubmarineController.Instance.moveSpeed = 10;
     }
     FishGenerate.Instance.GenerateFish();
     BGmanager.Instance.GenerateWaterF();
     BGmanager.Instance.GenerateParallx();
     BGmanager.Instance.GenerateBubble();
     SubmarineController.Instance.InitProgressSlider();
     HideUI();
     SubmarineController.Instance.progressSlider.gameObject.SetActive(true);
     SubmarineController.Instance.SynDepth();
     PlayerPrefs.SetInt("quitGame", 0);
 }
コード例 #20
0
    public void ChangeArea()
    {
        int index = 0;

        if (transform.name == "Area1")
        {
            index = 0;
        }
        if (transform.name == "Area2")
        {
            index = 10;
        }
        if (transform.name == "Area3")
        {
            index = 20;
        }
        Illustration.Instance.fishImage    = fishImage;
        Illustration.Instance.fishName     = fishName;
        Illustration.Instance.unusualImage = unusualImage;
        Illustration.Instance.unLockImage  = unLockImage;
        Illustration.Instance.IllUpdate(index);
        transform.GetComponent <Image> ().color = new Color(0.5f, 0.5f, 0.5f);
        MultiHaptic.HapticMedium();
    }
コード例 #21
0
 public void OnMapBtn()
 {
     gameObject.SetActive(true);
     point.DOPunchPosition(new Vector3(0, 10, 0), 1, 5, 1, false).SetLoops(10);
     MultiHaptic.HapticMedium();
 }
コード例 #22
0
 public void OnLevel4Btn()
 {
     MultiHaptic.HapticMedium();
     GenerateText(lv4, "当前关卡还未开放!");
 }
コード例 #23
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (playerRig.gravityScale != gravityScale)
        {
            playerRig.gravityScale = gravityScale;
        }
        if (ProgressManager.Instance.isRunning)
        {
            if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
            {
                if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
                {
                    if (Input.GetTouch(0).deltaPosition.x > 0)
                    {
                        transform.rotation = Quaternion.Euler(0, 0, 0);
                    }
                    if (Input.GetTouch(0).deltaPosition.x < 0)
                    {
                        transform.rotation = Quaternion.Euler(0, 180, 0);
                    }
                    transform.Translate(new Vector3(Input.GetTouch(0).deltaPosition.x *moveSpeed *Time.deltaTime, 0, 0), Space.World);
                }
            }
            else
            {
                if (Input.GetKey(KeyCode.A))
                {
                    transform.rotation = Quaternion.Euler(0, 180, 0);
                    transform.Translate(new Vector3(-moveSpeed * Time.deltaTime, 0, 0), Space.World);
                }
                else if (Input.GetKey(KeyCode.D))
                {
                    transform.rotation = Quaternion.Euler(0, 0, 0);
                    transform.Translate(new Vector3(moveSpeed * Time.deltaTime, 0, 0), Space.World);
                }
            }
            progressSlider.value = transform.position.y;
        }
        if (isSettle)
        {
            if (PlayerPrefs.GetInt("golden_net", 0) == 1)
            {
                HidePopUI(false);
            }
            else
            {
                HidePopUI(true);
            }
            time += Time.deltaTime;
            if (time > settleTime)
            {
                if (fishIndex < settleCount)
                {
                    Transform fish = netParent.GetChild(fishIndex);
                    Settlement(fish, 0.3f);
                    if (PlayerPrefs.GetInt(fish.name.Split(new char[] { '(' }) [0], 0) == 0)
                    {
                        PlayerPrefs.SetInt("illNew", 1);
                    }
                    PlayerPrefs.SetInt(fish.name.Split(new char[] { '(' }) [0], 1);
                    ScoreGenerate(fish);
                }
                else if (fishIndex == settleCount)
                {
                    Transform fish = netParent.GetChild(fishIndex);
                    fish.DOScale(1, 0.3f).OnComplete(() => {
                        fish.GetComponent <SpriteRenderer> ().DOFade(0f, 0.3f);
                        if (fish.childCount > 0)
                        {
                            Destroy(fish.GetChild(0).gameObject);
                        }
                        isSettle = false;

                        GameObject popBG      = (GameObject)Resources.Load("PopBG");
                        Transform doubleTrans = popBG.transform.Find("double");

                        if (PlayerPrefs.GetInt("double", 0) >= 2)
                        {
                            //doubleTrans.DOPunchRotation(new Vector3(100,100,100),1,10,1);
                            //MessageBox.Messagebox.transform.Find("double").DOPunchRotation(new Vector3(1,1,1),1,10,1);
                            int levelIndex = PlayerPrefs.GetInt("Level", 1);
                            if (levelIndex == 1)
                            {
                                doubleTrans.GetComponentInChildren <Text>().text = "Bonus✖️️3";
                            }
                            if (levelIndex == 2)
                            {
                                doubleTrans.GetComponentInChildren <Text>().text = "Bonus✖️️4";
                            }
                            if (levelIndex == 3)
                            {
                                doubleTrans.GetComponentInChildren <Text>().text = "Bonus✖️️5";
                            }
                        }
                        //UpdateGoldMutiple ();

                        if (!TGSDK.CouldShowAd(TGSDKManager.doubleID))
                        {
                            doubleTrans.GetComponent <Button> ().interactable = false;
                        }
                        else
                        {
                            doubleTrans.GetComponent <Button> ().interactable = true;
                        }

                        MessageBox.Show("You Earend", "$" + UIManager.UnitChange(goldSum));
                        if (PlayerPrefs.GetInt("double", 0) >= 2)
                        {
                            Transform doubleTrans1 = GameObject.FindGameObjectWithTag("PopBG").transform.Find("double");
                            if (doubleTrans != null)
                            {
                                doubleTrans1.DOPunchRotation(new Vector3(0, 0, 5), 1, 5, 1).SetLoops(100);
                            }
                        }
                        MessageBox.confim = () => {
                            int gold = PlayerPrefs.GetInt("gold", 0) + goldSum * goldMultiple;
                            PlayerPrefs.SetInt("gold", gold);
                            Upgrading.Instance.CheckGold();
                            UpgradingOffline.Instance.CheckGold();
                            ProgressManager.Instance.GameWin();
                            PlayerPrefs.SetInt("double", PlayerPrefs.GetInt("double", 0) + 1);
                        };
                        MessageBox.doubleR = () => {
                            //GameObject popBG = (GameObject)Resources.Load("PopBG");
                            //Transform doubleTrans = popBG.transform.Find("double");
                            string doubleName = doubleTrans.GetComponentInChildren <Text>().text;
                            int gold          = 0;
                            goldSum          *= goldMultiple;
                            if (doubleName == "Bonus✖️️3")
                            {
                                gold = PlayerPrefs.GetInt("gold", 0) + goldSum * 3;
                            }
                            else if (doubleName == "Bonus✖️️4")
                            {
                                gold = PlayerPrefs.GetInt("gold", 0) + goldSum * 4;
                            }
                            else if (doubleName == "Bonus✖️️5")
                            {
                                gold = PlayerPrefs.GetInt("gold", 0) + goldSum * 5;
                            }
                            else if (doubleName == "Bonus✖️️2")
                            {
                                gold = PlayerPrefs.GetInt("gold", 0) + goldSum * 2;
                            }

                            PlayerPrefs.SetInt("gold", gold);
                            Upgrading.Instance.CheckGold();
                            UpgradingOffline.Instance.CheckGold();
                            ProgressManager.Instance.GameWin();
                            PlayerPrefs.SetInt("double", 0);
                            if (TGSDK.CouldShowAd(TGSDKManager.tripleID))
                            {
                                TGSDK.ShowAd(TGSDKManager.tripleID);
                            }
                        };
                    });

                    if (PlayerPrefs.GetInt(fish.name.Split(new char[] { '(' }) [0], 0) == 0)
                    {
                        PlayerPrefs.SetInt("illNew", 1);
                    }
                    PlayerPrefs.SetInt(fish.name.Split(new char[] { '(' }) [0], 1);
                    ScoreGenerate(fish);
                    PlayerPrefs.SetInt("accumulation", PlayerPrefs.GetInt("accumulation", 0) + (int)(goldSum * 0.6f));
                }
                MultiHaptic.HapticLight();
                fishIndex++;
                time = 0;
            }
        }
    }
コード例 #24
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);
            }
        }
    }
コード例 #25
0
 public void OnLevel4Btn()
 {
     MultiHaptic.HapticMedium();
     GenerateText(lv4, "To Be Continue...");
 }