public void Start() { //For new level(restart) Touch.S_Touch = "nope"; B_First = true; B_Second = true; gameObject.transform.localScale = new Vector3(0, 0, 0); B_SpawnEffect = true; B_Lose = true; I_level = 1; LevelText.ChangeLevelText(); F_Speed = 0; F_SpeedValue = 0.00005f; B_IsScale = false; V_NewLevel(); }
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); } }