Example #1
0
 void Start()
 {
     pfm = MasterController.BRAIN.pm();
     EquationGenerator eq = new EquationGenerator(pfm.get_operations(),pfm.get_eqFormat());
     equation = eq.Equation();
     answer = eq.answer();
     operation = eq.eqOperation();
 }
Example #2
0
    void Awake()
    {
        _goalTotal         = GetComponent <GoalTotal>();
        _tileStack         = new Stack <GameTile>();
        _equationGenerator = GameObject.FindObjectOfType <EquationGenerator>();

        _stf = new StringToFormula();
    }
 void createEquation()
 {
     EquationGenerator eg = new EquationGenerator(EquationGenerator.ADDITION |
                                                  EquationGenerator.SUBTRACTION |
                                                  EquationGenerator.MULTIPLICATION |
                                                  EquationGenerator.DIVISION,
                                                  EquationGenerator.MIXED
                                                 );
     equation.text = eg.Equation();
     answer = eg.answer();
 }
Example #4
0
    private void BuildRound()
    {
        string[] sampleEquation;
        var      mixedEquation = EquationGenerator.generate(diff.MATH_OPERATOR, diff.allowNegatives, diff.MIN, diff.MAX, out sampleEquation);

        writer.setBlockValues(mixedEquation);

        Block[] equationBlocks = writer.getBlocksbyString(sampleEquation);

        FillSlotsByEquation(equationBlocks, diff.placeinslot);
    }
Example #5
0
    /// Generates the new equation.
    IEnumerator GenerateNewEquation(bool isFirstEquation = false)
    {
        if (!isFirstEquation)
        {
            iTween.MoveTo(txtEquation.gameObject, iTween.Hash("x", -5F, "time", 0.1F, "easeType", iTween.EaseType.linear));
            iTween.MoveTo(txtEquationResult.gameObject, iTween.Hash("x", -5F, "time", 0.1F, "easeType", iTween.EaseType.linear));
            yield return(new WaitForSeconds(0.1F));

            txtEquation.rectTransform.anchoredPosition       = new Vector2(500, txtEquation.rectTransform.anchoredPosition.y);
            txtEquationResult.rectTransform.anchoredPosition = new Vector2(500, txtEquationResult.rectTransform.anchoredPosition.y);
            iTween.MoveTo(txtEquation.gameObject, iTween.Hash("x", 0F, "time", 0.1F, "easeType", iTween.EaseType.linear));
            iTween.MoveTo(txtEquationResult.gameObject, iTween.Hash("x", 0F, "time", 0.1F, "easeType", iTween.EaseType.linear));
        }
        equation               = new EquationGenerator(score);
        txtEquation.text       = equation.equationValue1 + "" + equation.equationSign + "" + equation.equationValue2;
        txtEquationResult.text = "=" + equation.equationResult;
    }
Example #6
0
        public JsonResult Get()
        {
            string mathTest  = "";
            string ipAddress = GetIPAddress();

            if (RequestTracker.IsRequestExpired(ipAddress))
            {
                mathTest = EquationGenerator.GenerateMathTest();
                RequestTracker.AddToTracker(ipAddress, mathTest);
            }
            else
            {
                mathTest = RequestTracker.GetPreviousMathTest(ipAddress);
            }
            return(new JsonResult(new MathEquation()
            {
                Problem = mathTest
            }));
        }
Example #7
0
    public void onCorrectAnswer(EquationGenerator.EquationOperation operation)
    {
        SoundManager.SOUNDS.playSound(SoundManager.SFX_RIGHT_NUM_HIT,CameraCollider.MATHIUS_EARTH_CAM);
        switch(operation){
            case EquationGenerator.EquationOperation.ADDITION:
                _bonus_points += ADDITION_BONUS;
                break;
            case EquationGenerator.EquationOperation.SUBTRACTION:
                _bonus_points += SUBTRACTION_BONUS;
                break;
            case EquationGenerator.EquationOperation.MULTIPLICATION:
                _bonus_points += MULTIPLICATION_BONUS;
                break;
            case EquationGenerator.EquationOperation.DIVISION:
                _bonus_points += DIVISION_BONUS;
                break;
            default:
                break;
        }

        _correct++;
        _problems_to_clear--;
        if(_problems_to_clear <= 0){MasterController.BRAIN.onReachProblemsSolved();}
        _streak_build++;
        if(_streak_build >=_streakCriteria && !_isOnStreak){
            _isOnStreak = true;
            return;
        }
        if(_isOnStreak){
            _streak++;
        }
    }
Example #8
0
 /// Generates the new equation.
 IEnumerator GenerateNewEquation(bool isFirstEquation = false)
 {
     if(!isFirstEquation)
     {
         iTween.MoveTo(txtEquation.gameObject,iTween.Hash("x",-5F,"time",0.1F,"easeType",iTween.EaseType.linear));
         iTween.MoveTo(txtEquationResult.gameObject,iTween.Hash("x",-5F,"time",0.1F,"easeType",iTween.EaseType.linear));
         yield return new WaitForSeconds(0.1F);
         txtEquation.rectTransform.anchoredPosition = new Vector2(500,txtEquation.rectTransform.anchoredPosition.y);
         txtEquationResult.rectTransform.anchoredPosition = new Vector2(500,txtEquationResult.rectTransform.anchoredPosition.y);
         iTween.MoveTo(txtEquation.gameObject,iTween.Hash("x",0F,"time",0.1F,"easeType",iTween.EaseType.linear));
         iTween.MoveTo(txtEquationResult.gameObject,iTween.Hash("x",0F,"time",0.1F,"easeType",iTween.EaseType.linear));
     }
     equation = new EquationGenerator (score);
     txtEquation.text = equation.equationValue1 + "" + equation.equationSign + "" + equation.equationValue2;
     txtEquationResult.text = "=" + equation.equationResult;
 }
Example #9
0
 void Awake()
 {
     _graphicRaycaster  = GetComponent <GraphicRaycaster>();
     _equationGenerator = GameObject.FindObjectOfType <EquationGenerator>();
 }
 // Use this for initialization
 void Start()
 {
     eg = GetComponent <EquationGenerator>();
 }