Пример #1
0
//	void onGUI()
//	{
//		scoreText.text = "Score: " + score.ToString();
//		GUI.Box (new Rect (Screen.width/2, Screen.height/2, sizeX, sizeY), "Score" + scoreText.text);
//	}

//***********************************************************************//
//********************* Button Handler *********************************//
//*********************************************************************//

    public void buttonhandler()    //Button clickedbutton
    {
        Debug.Log("button handler working");
        gameTimer game_Timer = GetComponent <gameTimer>();

        switch (gameState)
        {
//****************** ROUND ONE QUESTION ONE ************************************//
        case GameState.Round1Question1:

            Debug.Log("You are in Game State Button Handler Round1Question 1");
            if (EventSystem.current.currentSelectedGameObject.name == "rule404btn3")
            {
                Debug.Log("Question 1 Round 1 correct answer");
                AddScore(50);
                audioSustained.Play();
            }
            else
            {
                Debug.Log("Question 1 Round 1 wrong answer");
                audioOverruled.Play();
                AddScore(-50);
                angryscore(1);
                ResetTimer();
            }
            Debug.Log(EventSystem.current.currentSelectedGameObject.name);
            ResetTimer();
            audioQuestion2.PlayDelayed(3);
            SetGameState(GameState.Round1Question2);
            Debug.Log("You changed Game State to Round1Question 2");
            break;

//****************** ROUND ONE QUESTION TWO ************************************//
        case GameState.Round1Question2:
            Debug.Log("You are in Game State Round1Question 2");
            if (EventSystem.current.currentSelectedGameObject.name == "rule404btn3")
            {
                AddScore(10);
                audioSustained.Play();
                Debug.Log("Question 2 Round 1 correct answer");
            }
            else
            {
                Debug.Log("Question 2 Round 1 wrong answer");
                AddScore(-10);
                audioOverruled.Play();
                angryscore(1);
            }

            Debug.Log(EventSystem.current.currentSelectedGameObject.name);
            ResetTimer();
            audioQuestion3.PlayDelayed(3);
            SetGameState(GameState.Round1Question3);

            Debug.Log("You changed Game State to Round1Question 3");
            break;

//****************** ROUND ONE QUESTION THREE ************************************//
        case GameState.Round1Question3:
            Debug.Log("You are in Game State Round1Question 3");
            if (EventSystem.current.currentSelectedGameObject.name == "rule404btn1")
            {
                Debug.Log("Question 3 Round 1 correct answer");
                AddScore(50);
                audioSustained.Play();
            }
            else
            {
                Debug.Log("Question 3 Round 1 wrong answer");
                AddScore(-50);
                audioOverruled.Play();
                angryscore(1);
            }
            Debug.Log(EventSystem.current.currentSelectedGameObject.name);
            SetGameState(GameState.Round1Question4);
            audioQuestion4.PlayDelayed(5);
            game_Timer.ResetTimer();
            Debug.Log("You changed Game State to Round1Question 4");
            break;

//****************** ROUND ONE QUESTION FOUR ************************************//
        case GameState.Round1Question4:
            Debug.Log("You are in Game State Round1Question 4");
            if (EventSystem.current.currentSelectedGameObject.name == "noObjection")
            {
                AddScore(10);
                audioSustained.Play();
                Debug.Log("Question 4 Round 1 correct answer");
            }
            else
            {
                Debug.Log("Question 4 Round 1 wrong answer");
                AddScore(-10);
                audioOverruled.Play();
                angryscore(1);
            }
            Debug.Log(EventSystem.current.currentSelectedGameObject.name);
            SetGameState(GameState.Round1Question5);
            audioQuestion5.PlayDelayed(5);
            game_Timer.ResetTimer();
            Debug.Log("You changed Game State to Round1Question 5");
            break;

//****************** ROUND ONE QUESTION FIVE ************************************//
        case GameState.Round1Question5:
            Debug.Log("You are in Game State Round1Question 5");
            if (EventSystem.current.currentSelectedGameObject.name == "rule404btn2")
            {
                Debug.Log("Question 5 Round 1 correct answer");
                audioSustained.Play();
                AddScore(25);
            }
            else
            {
                Debug.Log("Question 5 Round 1 wrong answer");
                AddScore(-25);
                audioOverruled.Play();
                //
                angryscore(1);
            }
            Debug.Log(EventSystem.current.currentSelectedGameObject.name);
            SetGameState(GameState.Round1Question6);
            game_Timer.ResetTimer();
            Debug.Log("You changed Game State to Round1Question 6");
            break;

//****************** ROUND ONE QUESTION SIX ************************************//
        case GameState.Round1Question6:
            Debug.Log("You are in Game State Round1Question6");
            if (EventSystem.current.currentSelectedGameObject.name == "rule404btn2")
            {
                Debug.Log("Question 6 Round 1 correct answer");
                audioSustained.Play();
                AddScore(50);
            }
            else
            {
                Debug.Log("Question 6 Round 1 wrong answer");
                audioOverruled.Play();
            }
            Debug.Log(EventSystem.current.currentSelectedGameObject.name);
            SetGameState(GameState.Round1Question7);
            game_Timer.ResetTimer();
            //Debug.Log ("You changed Game State to Round1Question 7");
            break;

////****************** ROUND ONE QUESTION SEVEN ************************************//
//		case GameState.Round1Question7:
//			Debug.Log ("You are in Game State Round1Question7");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule404btn2") {
//				Debug.Log ("Question 7 Round 1 correct answer");
//				audioSustained.Play ();
//				AddScore (50);
//			} else {
//				Debug.Log ("Question 7 Round 1 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round2Question1);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round1Question 7");
//			break;
//
////********************** Round Two *********************************//
////*********************************************************************//
//
////****************** ROUND TWO QUESTION ONE ************************************//
//		case GameState.Round2Question1:
//			Debug.Log ("You are in Game State Button Handler Round 2 Question 1");
//			if (EventSystem.current.currentSelectedGameObject.name == "noObjection") {
//				Debug.Log ("Question 1 Round 2 correct answer");
//				//audioSustained.Play ();
//				AddScore (10);
//
//			} else {
//				Debug.Log ("Question 1 Round 2 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			game_Timer.ResetTimer();
//			SetGameState (GameState.Round2Question2);
//			Debug.Log ("You changed Game State to Round 2 Question 2");
//			break;
//
////****************** ROUND TWO QUESTION TWO ************************************//
//		case GameState.Round2Question2:
//			Debug.Log ("You are in Game State Round 2 Question 2");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule609btn2") {
//				AddScore (100);
//				audioSustained.Play ();
//				Debug.Log ("Question 2 Round 2 correct answer");
//			} else {
//				Debug.Log ("Question 2 Round 2 wrong answer");
//				audioOverruled.Play ();
//			}
//
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			game_Timer.ResetTimer();
//			SetGameState (GameState.Round2Question3);
//
//			Debug.Log ("You changed Game State to Round 2 Question 3");
//			break;
//
////****************** ROUND TWO QUESTION THREE ************************************//
//		case GameState.Round2Question3:
//			Debug.Log ("You are in Game State Round 2 Question 3");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule404btn2") {
//				Debug.Log ("Question 3 Round 2 correct answer");
//				audioSustained.Play ();
//				AddScore (300);
//			} else {
//				Debug.Log ("Question 3 Round 2 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			game_Timer.ResetTimer();
//			SetGameState (GameState.Round2Question4);
//			Debug.Log ("You changed Game State to Round 2 Question 4");
//			break;
//
////****************** ROUND TWO QUESTION FOUR ************************************//
//		case GameState.Round2Question4:
//			Debug.Log ("You are in Game State Round 2 Question 4");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule608btn1") {
//				AddScore (50);
//				audioSustained.Play ();
//				Debug.Log ("Question 4 Round 2 correct answer");
//			} else {
//				Debug.Log ("Question 4 Round 2 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round2Question5);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round 2 Question 5");
//			break;
//
////****************** ROUND TWO QUESTION FIVE ************************************//
//		case GameState.Round2Question5:
//			Debug.Log ("You are in Game State Round 2 Question 5");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule608btn4") {
//				Debug.Log ("Question 5 Round 2 correct answer");
//				audioSustained.Play ();
//				AddScore (50);
//			} else {
//				Debug.Log ("Question 5 Round 2 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round3Question1);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round 3 Question 1");
//			break;
//
////********************** Round THREE *********************************//
////*********************************************************************//
//
////****************** ROUND THREE QUESTION ONE ************************************//
//		case GameState.Round3Question1:
//			Debug.Log ("You are in Game State Button Handler Round3Question 1");
//			if (EventSystem.current.currentSelectedGameObject.name == "noObjection") {
//				Debug.Log ("Question 1 Round 3 correct answer");
//				//audioSustained.Play ();
//				AddScore (10);
//
//			} else {
//				Debug.Log ("Question 1 Round 3 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round3Question2);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round3Question 2");
//			break;
//
////****************** ROUND THREE QUESTION TWO ************************************//
//		case GameState.Round3Question2:
//			Debug.Log ("You are in Game State Round3Question 2");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule404btn2") {
//				AddScore (500);
//				audioSustained.Play ();
//				Debug.Log ("Question 2 Round 3 correct answer");
//			} else {
//				Debug.Log ("Question 2 Round 3 wrong answer");
//				audioOverruled.Play ();
//			}
//
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round3Question3);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round 3 Question 3");
//			break;
//
////****************** ROUND THREE QUESTION THREE ************************************//
//		case GameState.Round3Question3:
//			Debug.Log ("You are in Game State Round 3 Question 3");
//			if (EventSystem.current.currentSelectedGameObject.name == "noObjection") {
//				Debug.Log ("Question 3 Round 3 correct answer");
//				//audioSustained.Play ();
//				AddScore (50);
//			} else {
//				Debug.Log ("Question 3 Round 3 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round3Question4);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round 3 Question 4");
//			break;
//
////****************** ROUND THREE QUESTION FOUR ************************************//
//		case GameState.Round3Question4:
//			Debug.Log ("You are in Game State Round 3 Question 4");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule608btn3") {
//				AddScore (50);
//				audioSustained.Play ();
//				Debug.Log ("Question 4 Round 3 correct answer");
//			} else {
//				Debug.Log ("Question 4 Round 3 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round3Question5);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round 3 Question 5");
//			break;
//
////****************** ROUND THREE QUESTION FIVE ************************************//
//		case GameState.Round3Question5:
//			Debug.Log ("You are in Game State Round 3 Question 5");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule609btn3") {
//				Debug.Log ("Question 5 Round 3 correct answer");
//				audioSustained.Play ();
//				AddScore (25);
//			} else {
//				Debug.Log ("Question 5 Round 3 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round3Question6);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round 3 Question 6");
//			break;
//
////****************** ROUND THREE QUESTION SIX ************************************//
//		case GameState.Round3Question6:
//			Debug.Log ("You are in Game State Round 3 Question6");
//			if (EventSystem.current.currentSelectedGameObject.name == "noObjection") {
//				Debug.Log ("Question 6 Round 3 correct answer");
//				//audioSustained.Play ();
//				AddScore (10);
//			} else {
//				Debug.Log ("Question 6 Round 3 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round3Question7);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round 3 Question 7");
//			break;
//
////****************** ROUND THREE QUESTION SEVEN ************************************//
//		case GameState.Round3Question7:
//			Debug.Log ("You are in Game State Round 3 Question7");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule404btn2") {
//				Debug.Log ("Question 7 Round 3 correct answer");
//				audioSustained.Play ();
//				AddScore (250);
//			} else {
//				Debug.Log ("Question 7 Round 3 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			SetGameState (GameState.Round3Question8);
//			game_Timer.ResetTimer();
//			Debug.Log ("You changed Game State to Round 3 Question 8");
//			break;
////****************** ROUND THREE QUESTION EIGHT ************************************//
//		case GameState.Round3Question8:
//			Debug.Log ("You are in Game State Round 3 Question8");
//			if (EventSystem.current.currentSelectedGameObject.name == "rule404btn2") {
//				Debug.Log ("Question 8 Round 3 correct answer");
//				audioSustained.Play ();
//				AddScore (500);
//			} else {
//				Debug.Log ("Question 8 Round 3 wrong answer");
//				audioOverruled.Play ();
//			}
//			Debug.Log (EventSystem.current.currentSelectedGameObject.name);
//			//SetGameState (END GAME);
//			game_Timer.ResetTimer();
//			Debug.Log ("END OF GAME");
//			break;
//***********************************************************************//
//************************** DEFAULT ************************************//
        default:
            Debug.Log("ERROR: Unknown game state: " + gameState);
            break;
        }
    }
Пример #2
0
//***********************************************************************//
//********************* Timer Functions ********************************//
//*********************************************************************//
    void ResetTimer()
    {
        gameTimer game_Timer = GetComponent <gameTimer>();

        game_Timer.ResetTimer();
    }