Example #1
0
 private void setColor()
 {
     Ans1.GetComponent <Image>().color = Color.white;
     Ans2.GetComponent <Image>().color = Color.white;
     Ans3.GetComponent <Image>().color = Color.white;
     Ans4.GetComponent <Image>().color = Color.white;
 }
Example #2
0
    IEnumerator DisplayCall()
    {
        yield return(new WaitForSeconds(sec));

        RanMsg.SetActive(false);
        gameHandler.GetComponent <ReadMCQ>().nextQns();
        if (isPlayerDead)
        {
            GameOver_MSG.SetActive(true);
        }
        else if (isGameEnd)
        {
            Clear_Msg.SetActive(true);
            //put method and go back to world selection
        }
        else if (!isGameEnd)
        {
            Ans1Sel = false;
            Ans2Sel = false;
            Ans3Sel = false;
            Ans4Sel = false;
            Ans1.GetComponent <TextBG>().Unselectedbtn();
            Ans2.GetComponent <TextBG>().Unselectedbtn();
            Ans3.GetComponent <TextBG>().Unselectedbtn();
            Ans4.GetComponent <TextBG>().Unselectedbtn();
            MCQ_UI.SetActive(true);
            timeUP      = false;
            timeAtkMode = timeAtkMode1;
        }
    }
Example #3
0
    private void warriorSkill()
    {
        int RadAns = Random.Range(0, 2);

        if (RadAns == 0)
        {
            if (currMCQs[2] == "T")
            {
                Ans1.GetComponent <Image>().color = Color.red;
            }
            else if (currMCQs[4] == "T")
            {
                Ans2.GetComponent <Image>().color = Color.red;
            }
            else if (currMCQs[6] == "T")
            {
                Ans3.GetComponent <Image>().color = Color.red;
            }
            else if (currMCQs[8] == "T")
            {
                Ans4.GetComponent <Image>().color = Color.red;
            }
        }
        else
        {
            magicianSkill();
        }
    }
 void SelectedAns4()
 {
     Ans1Sel = false;
     Ans2Sel = false;
     Ans3Sel = false;
     Ans4Sel = true;
     Ans1.GetComponent <TextBG>().Unselectedbtn();
     Ans2.GetComponent <TextBG>().Unselectedbtn();
     Ans3.GetComponent <TextBG>().Unselectedbtn();
     Ans4.GetComponent <TextBG>().Selectedbtn();
 }
 void SelectedAns1()
 {
     //Debug.Log("You have clicked the Ans1!");
     Ans1Sel = true;
     Ans2Sel = false;
     Ans3Sel = false;
     Ans4Sel = false;
     Ans1.GetComponent <TextBG>().Selectedbtn();
     Ans2.GetComponent <TextBG>().Unselectedbtn();
     Ans3.GetComponent <TextBG>().Unselectedbtn();
     Ans4.GetComponent <TextBG>().Unselectedbtn();
 }
Example #6
0
 void SelectedAns2Inverse()
 {
     if (Ans2Sel)
     {
         Ans2Sel = false;
         Ans2.GetComponent <TextBG>().Unselectedbtn();
     }
     else
     {
         Ans2Sel = true;
         Ans2.GetComponent <TextBG>().Selectedbtn();
     }
 }
Example #7
0
        private void btn_click(object sender, EventArgs e)
        {
            double A, B, C;

            A = Convert.ToDouble(a.Text);
            B = Convert.ToDouble(b.Text);
            C = Convert.ToDouble(c.Text);
            double Ans1, Ans2, va;

            va       = Math.Sqrt(B * B - 4 * A * C);
            Ans1     = (-B + va) / (2 * A);
            Ans2     = (-B - va) / (2 * A);
            Ans.Text = " Ans1=" + Ans1.ToString("0.0#") + " Ans2=" + Ans2.ToString("0.0#");
        }
    //public GameObject GameManager;
    // Start is called before the first frame update
    void Start()
    {
        gameHandler  = GameObject.FindWithTag("GameController");
        enemyHandler = GameObject.FindWithTag("EnemyHandler");
        Alert.SetActive(false);
        Button btn = Ans1.GetComponent <Button>();

        btn.onClick.AddListener(SelectedAns1);
        Button btn2 = Ans2.GetComponent <Button>();

        btn2.onClick.AddListener(SelectedAns2);
        Button btn3 = Ans3.GetComponent <Button>();

        btn3.onClick.AddListener(SelectedAns3);
        Button btn4 = Ans4.GetComponent <Button>();

        btn4.onClick.AddListener(SelectedAns4);

        Button cfmbtn1 = cfmbtn.GetComponent <Button>();

        cfmbtn1.onClick.AddListener(confirmAns);
    }
Example #9
0
    public void skill()
    {
        playerHandler = GameObject.FindWithTag("PlayerHandler");

        //if player char is warrior, magician, or thief
        if (playerHandler.GetComponent <CharactersSel>().getChar() == 0)
        {
            warriorSkill();
        }
        else if (playerHandler.GetComponent <CharactersSel>().getChar() == 1)
        {
            if (currMCQs[2] == "T")
            {
                Ans1.GetComponent <Image>().color = Color.red;
            }
            else if (currMCQs[4] == "T")
            {
                Ans2.GetComponent <Image>().color = Color.red;
            }
            else if (currMCQs[6] == "T")
            {
                Ans3.GetComponent <Image>().color = Color.red;
            }
            else if (currMCQs[8] == "T")
            {
                Ans4.GetComponent <Image>().color = Color.red;
            }
            magicianSkill();
        }
        else if (playerHandler.GetComponent <CharactersSel>().getChar() == 3)
        {
            thiefSkill();
        }
        isSkillUsed            = true;
        skill_btn.interactable = false;
    }
Example #10
0
        }//private void AdjustDataGridViewSizing()

        private void button5_Click(object sender, EventArgs e)// [Truth table]
        {   // Create an unbound DataGridView by declaring a column count.
            dataGridView1.ColumnCount          = 5;
            dataGridView1.ColumnHeadersVisible = true;
            AdjustDataGridViewSizing();

            // Set the column header style.
            DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();

            columnHeaderStyle.BackColor = Color.Aqua;
            columnHeaderStyle.Font      = new Font("Verdana", 10, FontStyle.Bold);
            dataGridView1.ColumnHeadersDefaultCellStyle = columnHeaderStyle;

            // Set the column header names.
            dataGridView1.Columns[0].Name = "A";
            dataGridView1.Columns[1].Name = "B";
            dataGridView1.Columns[2].Name = "A && B";
            dataGridView1.Columns[3].Name = "A || B";
            dataGridView1.Columns[4].Name = "!A";

            // Populate the rows.
            bool A, B, Ans1, Ans2, Ans3;

            //
            A = true; B = true; Ans1 = A && B; Ans2 = A || B; Ans3 = !A;
            string[] row1 = new string[] { A.ToString(), B.ToString(), Ans1.ToString(), Ans2.ToString(), Ans3.ToString() };
            A = true; B = false; Ans1 = A && B; Ans2 = A || B; Ans3 = !A;
            string[] row2 = new string[] { A.ToString(), B.ToString(), Ans1.ToString(), Ans2.ToString(), Ans3.ToString() };

            A = false; B = true; Ans1 = A && B; Ans2 = A || B; Ans3 = !A;
            string[] row3 = new string[] { A.ToString(), B.ToString(), Ans1.ToString(), Ans2.ToString(), Ans3.ToString() };
            A = false; B = false; Ans1 = A && B; Ans2 = A || B; Ans3 = !A;
            string[] row4 = new string[] { A.ToString(), B.ToString(), Ans1.ToString(), Ans2.ToString(), Ans3.ToString() };
            //
            object[] rows = new object[] { row1, row2, row3, row4 };
            foreach (string[] rowArray in rows)
            {
                dataGridView1.Rows.Add(rowArray);
            }
            //
            // Set the row header style.
            DataGridViewCellStyle rowHeaderStyle = new DataGridViewCellStyle();

            rowHeaderStyle.BackColor = Color.Lime;
            rowHeaderStyle.Font      = new Font("Verdana", 7, FontStyle.Italic);
            dataGridView1.RowHeadersDefaultCellStyle = rowHeaderStyle;
            //
            dataGridView1.Rows[0].HeaderCell.Value = "a";
            dataGridView1.Rows[1].HeaderCell.Value = "b";
            dataGridView1.Rows[2].HeaderCell.Value = "c";
            dataGridView1.Rows[3].HeaderCell.Value = "d";
            //
            dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 7);
        }//private void button5_Click(object sender, EventArgs e)
Example #11
0
    //public GameObject GameManager;
    // Start is called before the first frame update
    void Start()
    {
        Audio2.Stop();
        timeUP = false;
        RanMsg.SetActive(false);
        BossHP_txt.SetActive(false);
        setWorldStr();
        SetupWorld();
        gameHandler  = GameObject.FindWithTag("GameController");
        enemyHandler = GameObject.FindWithTag("EnemyHandler");
        player       = GameObject.FindWithTag("Player");

        gameMode = gameHandler.GetComponent <ModeSelection>().getMode();

        if (gameMode == 2)
        {
            topTextDisplay[1].text = "Inverse";
            TimerBG.SetActive(false);
            Button btn = Ans1.GetComponent <Button>();
            btn.onClick.AddListener(SelectedAns1Inverse);
            Button btn2 = Ans2.GetComponent <Button>();
            btn2.onClick.AddListener(SelectedAns2Inverse);
            Button btn3 = Ans3.GetComponent <Button>();
            btn3.onClick.AddListener(SelectedAns3Inverse);
            Button btn4 = Ans4.GetComponent <Button>();
            btn4.onClick.AddListener(SelectedAns4Inverse);

            Button cfmbtn1 = cfmbtn.GetComponent <Button>();
            cfmbtn1.onClick.AddListener(confirmAnsInverse);
        }
        else if (gameMode == 1)
        {
            topTextDisplay[1].text = "Time Attack";
            Button btn = Ans1.GetComponent <Button>();
            btn.onClick.AddListener(SelectedAns1);
            Button btn2 = Ans2.GetComponent <Button>();
            btn2.onClick.AddListener(SelectedAns2);
            Button btn3 = Ans3.GetComponent <Button>();
            btn3.onClick.AddListener(SelectedAns3);
            Button btn4 = Ans4.GetComponent <Button>();
            btn4.onClick.AddListener(SelectedAns4);

            Button cfmbtn1 = cfmbtn.GetComponent <Button>();
            cfmbtn1.onClick.AddListener(confirmAns);

            Button skill_btn1 = skill_btn.GetComponent <Button>();
            skill_btn1.onClick.AddListener(skill);
        }
        else
        {
            topTextDisplay[1].text = "Normal";
            TimerBG.SetActive(false);
            Button btn = Ans1.GetComponent <Button>();
            btn.onClick.AddListener(SelectedAns1);
            Button btn2 = Ans2.GetComponent <Button>();
            btn2.onClick.AddListener(SelectedAns2);
            Button btn3 = Ans3.GetComponent <Button>();
            btn3.onClick.AddListener(SelectedAns3);
            Button btn4 = Ans4.GetComponent <Button>();
            btn4.onClick.AddListener(SelectedAns4);

            Button cfmbtn1 = cfmbtn.GetComponent <Button>();
            cfmbtn1.onClick.AddListener(confirmAns);

            Button skill_btn1 = skill_btn.GetComponent <Button>();
            skill_btn1.onClick.AddListener(skill);
        }

        Alert.SetActive(false);
        Clear_Msg.SetActive(false);
        GameOver_MSG.SetActive(false);
    }