Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        feedback   = "";
        bossQ      = FindObjectOfType <BossQuestions> ();
        fbPanel    = FindObjectOfType <FeedbackPanel> ();
        Health     = FindObjectOfType <HealthBar> ();
        bossHealth = FindObjectOfType <BossHealthBar> ();
        player     = FindObjectOfType <PlayerController> ();
        clear      = FindObjectOfType <GameButtons> ();

        correctFB = new string[] {
            "Way to go!",
            "You rock at this!",
            "Lookin’ good!",
            "Wow! I’m impressed!",
            "Keep at it!",
            "Good going!",
            "You were born a winner!",
            "Victory is yours!",
            "That was awesome!",
            "Great Job!",
            "Knew you could do it",
            "Great Job!",
            "You’re so good at this!",
            "That answer was perfect!"
        };

        wrongFB = new string[] {
            "That was terrible",
            "Better luck next time!",
            "You really went with that answer?",
            "FAIL"
        };
    }
 void Start()
 {
     index   = -1;
     boss    = FindObjectOfType <BossQuestions> ();
     qCanvas = FindObjectOfType <QuestionCanvas> ();
     panel   = FindObjectOfType <QuestionPanel> ();
     button1 = GameObject.FindGameObjectWithTag("Choice1");
     button2 = GameObject.FindGameObjectWithTag("Choice2");
     button3 = GameObject.FindGameObjectWithTag("Choice3");
     button4 = GameObject.FindGameObjectWithTag("Choice4");
 }
Esempio n. 3
0
    public void Pushed()
    {
        correct_answer = int.Parse(bossQ.getAnswer());
        print("correct answer inside buttonpushed is");
        print(correct_answer);
        Name = gameObject.name;
        print("Name is");
        print(Name);
        chosen = int.Parse(Name);

        int    questionID_int = BossQuestions.getQuestionID();     //BossQuestions.Instance.indexUsed.Item[questionID_idx];
        string questionID     = questionID_int.ToString();


        /*
         * if player chooses correct answer,
         * boss loses health and the question just answered is added to used questions arr
         */
        if (chosen == (int)correct_answer)
        {
            print("chose correct answer");

            //PlayerPrefs.SetString("CurrentPlayer", Name);

            EventHitBuilder eventHitBuilder = new EventHitBuilder();
            eventHitBuilder.SetEventCategory("Question Answered Correctly");
            eventHitBuilder.SetEventLabel(questionID);
            eventHitBuilder.SetEventValue(chosen);
            string playerName = PlayerPrefs.GetString("CurrentPlayer");
            if (playerName != null)
            {
                eventHitBuilder.SetEventAction(playerName);
            }
            else
            {
                eventHitBuilder.SetEventAction("No name");
            }
            googleAnalytics.LogEvent(eventHitBuilder);

            //googleAnalytics.LogEvent(eventHitBuilder);​

            /*
             *          googleAnalytics.LogEvent (new EventHitBuilder()
             *                  .SetEventCategory ("QuestionsAnsweredCorrectly")
             *                  .SetEventAction (EnterNameScript.Instance.Name)
             *                  .SetEventLabel (questionID)
             *                  .SetEventValue (chosen)); //When we create mode for game, it should be entered HERE
             */

            feedback = getCorrectFeedback();
            print("feedback received: " + feedback);
            player.rightSound.Play();
            bossHealth.changeBar(10);
            //BossQuestions.questionsUsed.Add (StompEnemy.ques);
            fbPanel.enableFBPanel(feedback, true);             //enable feedback panel
            clear.ClearQuestionDisplay();
            //Pause(10);
            //yield return new WaitForSeconds(10);
            Invoke("closePanel", 1);
        }
        if (chosen != (int)correct_answer)
        {
            print("chose wrong answer");

            EventHitBuilder eventHitBuilder = new EventHitBuilder();
            eventHitBuilder.SetEventCategory("Question Answered Incorrectly");
            eventHitBuilder.SetEventLabel(questionID);
            eventHitBuilder.SetEventValue(chosen);
            string playerName = PlayerPrefs.GetString("CurrentPlayer");
            if (playerName != null)
            {
                eventHitBuilder.SetEventAction(playerName);
            }
            else
            {
                eventHitBuilder.SetEventAction("No name");
            }
            googleAnalytics.LogEvent(eventHitBuilder);


            feedback = getWrongFeedback();
            print("feedback received: " + getWrongFeedback());
            //Health.changeBar (10);
            player.wrongSound.Play();
            fbPanel.enableFBPanel(feedback, false);             //enable feedback panel
            //yield return new WaitForSeconds(0);
        }
        //clear.ClearQuestionDisplay ();
    }