Ejemplo n.º 1
0
 private void Update()
 {
     if (Input.GetButtonDown("Jump"))
     {
         if (can.GetPlayerN() == gm.whoPLay && jump.IsGrounded())
         {
             if (caughtColor.GetColor() >= 0 && caughtColor.GetSprite() != null)
             {
                 if (aux < listCores.Count)
                 {
                     if (caughtColor.GetColor() == listCores[aux])
                     {
                         aux++;
                         gm.ScoreUp();
                         Debug.Log(aux);
                     }
                     else
                     {
                         lose = true;
                     }
                 }
                 else if (aux == listCores.Count && jump.IsGrounded())
                 {
                     if (coresAdd < quantCoresAdd)
                     {
                         gm.AddCor(caughtColor.GetColor(), caughtColor.GetSprite());
                         aux++;
                         coresAdd++;
                         Debug.Log(aux);
                     }
                 }
             }
         }
     }
     else if (coresAdd == quantCoresAdd && jump.IsGrounded())
     {
         aux                = 0;
         coresAdd           = 0;
         gm.whoPLay         = nextPlayer;
         transform.position = posiInicial.position;
     }
     if (lose)
     {
         if (multiplayer)
         {
             Destroy(this.gameObject);
         }
         else
         {
             Time.timeScale = 0f;
             scorePanel.SetActive(true);
         }
     }
 }