Exemple #1
0
 void Update()
 {
     if (Ball_Controller.B_Lose)
     {
         I_EdgeFillAmount.fillAmount += F_speed * Time.deltaTime; //timer
         if (I_EdgeFillAmount.fillAmount >= 1)                    //player will die
         {
             SoundManagerGame.V_PlaySoundLose();
             Ball_Controller.I_AdShow++;
             if (Advertisement.IsReady() && Ball_Controller.I_AdShow % 5 == 0)
             {
                 Advertisement.Show();
             }
             Ball_Controller.B_Lose = false;
             GameController.V_AdMoney();
             print("test Bar");
             StartCoroutine(LoseEffect.I_LoseEffect(
                                C_FromColor: new Color32(0, 0, 0, 0),
                                C_ToColor: new Color32(0, 0, 0, 113),
                                F_OverTime: 1f));
             StartCoroutine(GameButtons.I_RestartButtonCur(
                                C_ToColor: 203,
                                F_OverTime: 1));
             StartCoroutine(AdTotalCoinText.I_AdCoinCur(
                                C_ToColor: 203,
                                F_OverTime: 1));
         }
     }
 }
Exemple #2
0
    public IEnumerator I_OnRestartButtonCur()
    {
        SoundManagerGame.V_PlaySoundRestartGame();
        yield return(new WaitForSeconds(0.2f));

        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
Exemple #3
0
    public IEnumerator I_OnMaintButtonCur()
    {
        SoundManagerGame.V_PlaySoundToHome();
        yield return(new WaitForSeconds(0.2f));

        SceneManager.LoadScene("Main");
    }
Exemple #4
0
 public static void V_AdMoney()
 {
     if (Ball_Controller.I_level > PlayerPrefs.GetInt("I_Record"))
     {
         PlayerPrefs.SetInt("I_Record", Ball_Controller.I_level);
         T_RecordText.text = "New best!\n" + Ball_Controller.I_level;
         G_GameControllerClass.StartCoroutine(I_Record(255, 1f));
         SoundManagerGame.V_PlaySoundNewBest();
     }
     PlayerPrefs.SetInt("I_Money", PlayerPrefs.GetInt("I_Money") + Mathf.FloorToInt(Ball_Controller.I_level / 10));
     PlayerPrefs.SetInt("I_Total", PlayerPrefs.GetInt("I_Total") + Ball_Controller.I_level);
 }
    void Update()
    {
        transform.position = new Vector3(x: GameController.F_X, y: GameController.F_Y, z: transform.position.z); //Ball will be do bigger into the circle, near the Touch
        #region hold
        if (B_Lose)
        {
            if (Touch.S_Touch == "true" && !B_Second)
            {
                //Do ball bigger
                F_Speed += F_SpeedValue;
                transform.localScale = new Vector2(x: transform.localScale.y + F_Speed, y: transform.localScale.y + F_Speed);
            }

            //What happened (haw big ball when pleyer stop do it bigger)
            if (Touch.S_Touch == "false" && !B_First && !B_Second) //Middle
            {
                SoundManagerGame.V_PlaySoundLose();
                I_AdShow++;
                if (Advertisement.IsReady() && I_AdShow % 5 == 0)
                {
                    Advertisement.Show();
                }
                print("test Middle");
                Touch.S_Touch = "nope";
                GameController.V_AdMoney();
                StartCoroutine(LoseEffect.I_LoseEffect(
                                   C_FromColor: new Color32(0, 0, 0, 0),
                                   C_ToColor: new Color32(0, 0, 0, 113),
                                   F_OverTime: 1f));
                StartCoroutine(GameButtons.I_RestartButtonCur(
                                   C_ToColor: 203,
                                   F_OverTime: 1));
                StartCoroutine(AdTotalCoinText.I_AdCoinCur(
                                   C_ToColor: 203,
                                   F_OverTime: 1));
                B_Lose = false;
            }
            if (Touch.S_Touch == "false" && B_First && !B_Second) //Win
            {
                SoundManagerGame.V_PlaySoundPassLevel();
                LevelText.ChangeLevelText();
                print("test Win");
                Touch.S_Touch = "nope";
                I_level++;
                LevelText.ChangeLevelText();
                V_NewLevel();
                if (I_level >= I_WhenMoveCircle) //If level >= level after what value u d'like to move circle
                {
                    GameController.I_NewPos(
                        width: Random.Range(                                                          //Random range X
                            (Screen.width / 128.113f / 2 * -1) + (F_RandomScale * 3.25f),             //From(smoller)
                            (Screen.width / 128.113f / 2) - (F_RandomScale * 3.25f)),                 //To(bigger)
                        height: Random.Range(                                                         //Random range Y
                            (Screen.height / 128 / 2 * -1) + (F_RandomScale * 3.25f),                 //From(smoller)
                            (Screen.height / 128 / 2) - (F_RandomScale * 3.25f)));                    //To(bigger)
                }
                if (I_level <= 100)
                {
                    F_SpeedValue += 0.000003f;
                }
                ProgressBar.V_Win();
            }
            if ((Touch.S_Touch == "false" && B_Second) || B_Second) //Lose
            {
                SoundManagerGame.V_PlaySoundLose();
                I_AdShow++;
                if (Advertisement.IsReady() && I_AdShow % 5 == 0)
                {
                    Advertisement.Show();
                }
                print("test Lose");
                Touch.S_Touch = "nope";
                GameController.V_AdMoney();
                StartCoroutine(LoseEffect.I_LoseEffect(
                                   C_FromColor: new Color32(0, 0, 0, 0),
                                   C_ToColor: new Color32(0, 0, 0, 113),
                                   F_OverTime: 1f));
                StartCoroutine(GameButtons.I_RestartButtonCur(
                                   C_ToColor: 203,
                                   F_OverTime: 1));
                StartCoroutine(AdTotalCoinText.I_AdCoinCur(
                                   C_ToColor: 203,
                                   F_OverTime: 1));
                B_Lose = false;
            }
            if (Touch.S_Touch == "exit") //Exit
            {
                SoundManagerGame.V_PlaySoundLose();
                I_AdShow++;
                if (Advertisement.IsReady() && I_AdShow % 5 == 0)
                {
                    Advertisement.Show();
                }
                print("test Exit");
                Touch.S_Touch = "nope";
                GameController.V_AdMoney();
                StartCoroutine(LoseEffect.I_LoseEffect(
                                   C_FromColor: new Color32(0, 0, 0, 0),
                                   C_ToColor: new Color32(0, 0, 0, 113),
                                   F_OverTime: 1f));
                StartCoroutine(GameButtons.I_RestartButtonCur(
                                   C_ToColor: 203,
                                   F_OverTime: 1));
                StartCoroutine(AdTotalCoinText.I_AdCoinCur(
                                   C_ToColor: 203,
                                   F_OverTime: 1));
                B_Lose = false;
            }
        }
        #endregion
        if (B_IsScale)
        {
            G_LevelCircle.transform.localScale = Vector3.Lerp(
                a: V_LocalScale,
                b: G_LevelCircle.transform.localScale = new Vector3(F_RandomScale, F_RandomScale, transform.localScale.z),
                t: Time.deltaTime * F_SpeedScale);
            V_LocalScale = new Vector3(G_LevelCircle.transform.localScale.x, G_LevelCircle.transform.localScale.x, G_LevelCircle.transform.localScale.x);
        }
    }