Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.O) && pg.ap2 != 0)
     {
         pg.ap2 -= 1;
         Debug.Log("o");
         hp1.health -= 1;
         ///call punch
         source.PlayOneShot(punch, 5f);
     }
     if (Input.GetKeyDown(KeyCode.B))
     {
         if (pg.question == ("0U") || pg.question == ("3U"))
         {
             pg.ap2 += 1;
             source.PlayOneShot(correctSound1, .5f);
         }
         else
         {
             pg.ap2 -= 1;
             source.PlayOneShot(wrongSound1, .5f);
         }
         Debug.Log("Changing Problem");
         pg.question = pg.changeProblem();
         pg.flipTurn();
     }
     if (Input.GetKeyDown(KeyCode.N))
     {
         if (pg.question == ("1U"))
         {
             pg.ap2 += 1;
             source.PlayOneShot(correctSound1, .5f);
         }
         else
         {
             pg.ap2 -= 1;
             source.PlayOneShot(wrongSound1, .5f);
         }
         Debug.Log("Changing Problem");
         pg.question = pg.changeProblem();
         pg.flipTurn();
     }
     if (Input.GetKeyDown(KeyCode.M))
     {
         if (pg.question == ("4U"))
         {
             pg.ap2 += 1;
             source.PlayOneShot(correctSound1, .5f);
         }
         else
         {
             pg.ap2 -= 1;
             source.PlayOneShot(wrongSound1, .5f);
         }
         Debug.Log("Changing Problem");
         pg.question = pg.changeProblem();
         pg.flipTurn();
     }
     if (Input.GetKeyDown(KeyCode.Comma))
     {
         if (pg.question == ("2U"))
         {
             pg.ap2 += 1;
             source.PlayOneShot(correctSound1, .5f);
         }
         else
         {
             pg.ap2 -= 1;
             source.PlayOneShot(wrongSound1, .5f);
         }
         Debug.Log("Changing Problem");
         pg.question = pg.changeProblem();
         pg.flipTurn();
     }
     if (hp1.health == 0)
     {
         Application.LoadLevel("SteveWins");
     }
 }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.W) && pg.ap1 != 0)
     {
         pg.ap1 -= 1;
         Debug.Log("w");
         //put punch animation
         source.PlayOneShot(punch, 5f);
         hp2.health -= 1;
     }
     if (Input.GetKeyDown(KeyCode.Z))
     {
         if (pg.question == ("0U") || pg.question == ("3U"))
         {
             pg.ap1 += 1;
             source.PlayOneShot(correctSound, .5f);
         }
         else
         {
             pg.ap1 -= 1;
             source.PlayOneShot(wrongSound, .5f);
         }
         Debug.Log("Changing Problem");
         pg.question = pg.changeProblem();
         pg.flipTurn();
     }
     if (Input.GetKeyDown(KeyCode.C))
     {
         if (pg.question == ("4U"))
         {
             pg.ap1 += 1;
             source.PlayOneShot(correctSound, .5f);
         }
         else
         {
             pg.ap1 -= 1;
             source.PlayOneShot(wrongSound, .5f);
         }
         Debug.Log("Changing Problem");
         pg.question = pg.changeProblem();
         pg.flipTurn();
     }
     if (Input.GetKeyDown(KeyCode.X))
     {
         if (pg.question == ("1U"))
         {
             pg.ap1 += 1;
             source.PlayOneShot(correctSound, .5f);
         }
         else
         {
             pg.ap1 -= 1;
             source.PlayOneShot(wrongSound, .5f);
         }
         Debug.Log("Changing Problem");
         pg.question = pg.changeProblem();
         pg.flipTurn();
     }
     if (Input.GetKeyDown(KeyCode.V))
     {
         if (pg.question == ("2U"))
         {
             pg.ap1 += 1;
             source.PlayOneShot(correctSound, .5f);
         }
         else
         {
             pg.ap1 -= 1;
             source.PlayOneShot(wrongSound, .5f);
         }
         Debug.Log("Changing Problem");
         pg.question = pg.changeProblem();
         pg.flipTurn();
     }
     if (hp2.health == 0)
     {
         Application.LoadLevel("BatmanWins");
     }
 }