Пример #1
0
 private IEnumerator Updater()
 {
     while (true)
     {
         if (input.GetButton(1))
         {
             //Se caso o dinheiro do player for maior ou igual ao preço da torre,
             //Entao ele poderá instacia-la.
             if (point.points >= towerPrice)
             {
                 GameObject.Instantiate(tower, ship.position, ship.transform.rotation);
                 //Depois de instanciar a torre, é descontado dos seus pontos o valor que ela custa.
                 point.points -= towerPrice;
                 yield return(new WaitForSeconds(0.2f));
             }
         }
         if (input.GetButton(2))
         {
             //Se caso o dinheiro do player for maior ou igual ao preço da barreira,
             //Entao ele poderá instacia-la.
             if (point.points >= barrierPrice)
             {
                 GameObject.Instantiate(barrier, ship.transform.position, ship.transform.rotation);
                 //Depois de instanciar a torre, é descontado dos seus pontos o valor que ela custa.
                 point.points -= barrierPrice;
                 yield return(new WaitForSeconds(0.2f));
             }
         }
         yield return(new WaitForEndOfFrame());
     }
 }
 private IEnumerator Updater()
 {
     while (true)
     {
         if (input.GetButton(0))
         {
             GameObject.Instantiate(this.laser, ship.position, ship.rotation);
             yield return(new WaitForSeconds(this.fireRate));
         }
         yield return(new WaitForEndOfFrame());
     }
 }