Example #1
0
 // Update is called once per frame
 void Update()
 {
     for (int i = 0; i < swipeArr.Length && charData.shooting && PlayerPrefs.GetInt("Tutorial", 0) != 0; i++)
     {
         swipeArr[i].GetComponent <Image>().color = new Color(swipeArr[i].GetComponent <Image>().color.r, swipeArr[i].GetComponent <Image>().color.g, swipeArr[i].GetComponent <Image>().color.b, swipeArr[i].GetComponent <Image>().color.a - Time.deltaTime * fadeSpeed);
     }
     if (swipeArr.Length > 0)
     {
         if (swipeArr[0].GetComponent <Image>().color.a <= 0 || charData.swipeLifes == 0)
         {
             if (charData.swipeLifes != 0)
             {
                 obsData.RestoreSpeed();
                 GameObject.FindGameObjectWithTag("Character").GetComponent <Movement>().swipeLifesImage.transform.localScale = new Vector3(0, 1, 1);
             }
             charData.swipeLifes = 3;
             charData.shooting   = false;
             GameObject.Find("Heart Container").GetComponent <LifeManager>().LoseLife();
             Destroy(charData.shootingBall);
             for (int i = 0; i < swipeArr.Length; i++)
             {
                 swipeArr[i].GetComponent <Image>().color = new Color(swipeArr[i].GetComponent <Image>().color.r, swipeArr[i].GetComponent <Image>().color.g, swipeArr[i].GetComponent <Image>().color.b, 1);
             }
             for (int i = 0; i < swipeArr.Length; i++)
             {
                 swipeArr[i].transform.localScale = new Vector3(0, 1, 1);
             }
         }
     }
 }