private void ChargeController() { if (chargeCounter >= 10 && 20 >= chargeCounter && chargeImage.sprite != chargeSprites[1]) { chargeImage = GetComponent <Image>(); chargeImage.sprite = chargeSprites[1]; arrowGenerator = FindObjectOfType <ArrowGenerator>(); if (chargeLevel_1 == false) { ChargeSFX(); chargeLevel_1 = true; arrowGenerator.CreateArrow(); } } if (chargeCounter >= 30 && 40 >= chargeCounter && chargeImage.sprite != chargeSprites[2]) { chargeImage = GetComponent <Image>(); chargeImage.sprite = chargeSprites[2]; arrowGenerator = FindObjectOfType <ArrowGenerator>(); if (chargeLevel_2 == false) { ChargeSFX(); chargeLevel_1 = false; chargeLevel_2 = true; arrowGenerator.CreateArrow(); } } if (50 <= chargeCounter && 60 >= chargeCounter) { chargeImage = GetComponent <Image>(); chargeImage.sprite = chargeSprites[3]; if (chargeLevel_3 == false) { ChargeSFX(); barrier = FindObjectOfType <Barrier>(); barrier.CreateBarrier(); chargeLevel_3 = true; } } if (70 <= chargeCounter && 80 >= chargeCounter) { chargeImage = GetComponent <Image>(); chargeImage.sprite = chargeSprites[4]; if (chargeLevel_4 == false) { ChargeSFX(); barrier2 = FindObjectOfType <Barrier2>(); barrier2.CreateBarrier(); chargeLevel_4 = true; } } if (90 <= chargeCounter) { chargeImage = GetComponent <Image>(); chargeImage.sprite = chargeSprites[5]; if (chargeLevel_5 == false) { ChargeSFX(); maxCharge = true; PenetrateBall(); chargeLevel_5 = true; } } if (chargeLevel_5 == true) { StopPenetration(); } StageName = SceneManager.GetActiveScene().name; string chkStageName = StageName.Substring(5, 1); //see the 6th alphabet of the stagename if (chkStageName == "4") { ResetCharge(); } }