Example #1
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);
             }
         }
     }
 }
Example #2
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);
     }
 }
Example #3
0
 public void OnButtonClick()
 {
     if (PlayerPrefs.GetInt("vibration", 1) == 1)
     {
         MultiHaptic.HapticLight();
     }
 }
Example #4
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);
        }
    }
Example #5
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;
            }
        }
    }