Example #1
0
 protected void Start()
 {
     //textSoln.text = solution.ToString();
     equation.operation = Op.Add;
     textOperator.text  = Equation.OpToSymbol(curOperator);
     setter             = gameObject.GetComponent <EquationDecider>();
     setter.SetNewEquation();
 }
Example #2
0
/*        public void SetSolution(int sol)
 *      {
 *          equation.solution = sol;
 *          textSoln.text = equation.solution.ToString();
 *      }
 *
 *      public void SetOperator(Op op)
 *      {
 *          equation.operation = op;
 *          textOperator.text = Equation.OpToSymbol(equation.operation);
 *      }*/

        /*public void SetPermanentNumber(EquationHolder)
         * {
         *  equation.solution = sol;
         *  solutionNum.SetPermanentNumber(sol);
         * //            textSoln.text = equation.solution.ToString();
         * }*/

        public void SetEquation(Equation equation)
        {
            this.equation     = equation;
            textOperator.text = Equation.OpToSymbol(equation.operation);
            Action <EquationHolder, int?> setPermNum = delegate(EquationHolder holder, int?num)
            {
                if (num != null)
                {
                    holder.SetPermanentNumber(num ?? 0);
                }
            };

            setPermNum(solutionNum, equation.solution);
            setPermNum(leftNum, equation.leftNum);
            setPermNum(rightNum, equation.rightNum);
        }