当前位置: 首页>>代码示例>>C#>>正文


C# Question.CheckAnswer方法代码示例

本文整理汇总了C#中Question.CheckAnswer方法的典型用法代码示例。如果您正苦于以下问题:C# Question.CheckAnswer方法的具体用法?C# Question.CheckAnswer怎么用?C# Question.CheckAnswer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Question的用法示例。


在下文中一共展示了Question.CheckAnswer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChangeTurn

    //after determining answer do corresponding action
    public void ChangeTurn(Question obj , string playerchoice, int type)
    {
        //StartCoroutine(Hold());
        int temptime = 0;
        while(temptime < 50)
        {
            temptime ++;
        }
        bool correct = obj.CheckAnswer (playerchoice);
        //Debug.Log("play " + playerchoice + "type" + type);
        if(type == 1)
        {
            foreach(string q in MultipleAnswers)
            {
                //Debug.Log(q + "dsf" + playerchoice);
                if (q == playerchoice)
                {
                    return;
                }
            }
            MultipleAnswers.Add(playerchoice);
            if(MultipleAnswers.Count >= 2)
            {
                //go through each answer and make sure all is correct
                foreach(string s in MultipleAnswers)
                {

                    correct = obj.CheckAnswer(s);
                    //if not correct leace and continue function with wrong answer
                    if(!correct)
                    {
                        break;
                    }
                }
            }
            //only have 1 or less
            else
            {
                return;
            }

        }
        //resset the multiple answers
        MultipleAnswers.Clear();
        ClearMenu ();
        //reload tge battle screen
        LoadLvlBackground();
        //Background.GetComponent<Background>().LoadCombatBG();
        //reenable vision of enemies
        foreach (GameObject en in AvailableEnemies)
        {

            en.SetActive(true);
            en.GetComponent<GenericEnemy>().Show();
        }

        if (correct) {
            PlayerTurn(player.GetComponent<Player>().DealDamage(), CurrentEnemy.GetComponent<GenericEnemy>().name);
            //StartCoroutine(WaitTurn(player.GetComponent<Player>().DealDamage()));
            //determine type of weapon and then deal dmg accordinly

            //			CurrentEnemy.GetComponent<GenericEnemy> ().ReceiveDamage (player.GetComponent<Player>().DealDamage());
            //
            //			CurrentEnemy.GetComponent<LAppModelProxy>().model.GetDamaged();
            if (player.GetComponent<Player>().CurrentWeapon.Special  == true && player.GetComponent<Player>().CurrentWeapon.AffectAnswers == true )
            {
                HideAnswer = true;
            }
            if (CurrentEnemy.GetComponent<GenericEnemy> ().Alive == false) {
                //go through list and remove enemy
                //StartCoroutine(DropItem("Apple"));
                //StartCoroutine(WaitItem());

                //RoundOver = true;

                AvailableEnemies.Remove(CurrentEnemy);
                //iterate thorught the rest of enemies in case of cleave damage
                for(int i = 0; i < AvailableEnemies.Count; i ++)
                {
                    if(AvailableEnemies[i].GetComponent<GenericEnemy>().Alive == false)
                    {
                        AvailableEnemies.RemoveAt(i);
                    }
                }
                //if(AvailableEnemies.Count ==  0)
                //{
                //	//set up to next level

                //	RoundOver = true;
                //	//Debug.Log("end");
                //	//ClearMenu ();
                //	//LoadMenu ();

                //	return;
                //}
                //ClearMenu();

            }

//.........这里部分代码省略.........
开发者ID:leeh14,项目名称:Vocabulary,代码行数:101,代码来源:GameMaster_Control.cs


注:本文中的Question.CheckAnswer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。