public void TestEnsureICanParseTermsFromExpression()
 { 
     BasicTasks doSomething = new BasicTasks(); 
     doSomething.IdentifyOperator("3+2"); 
     Assert.AreEqual(doSomething.firstNumber, 3); 
     Assert.AreEqual(doSomething.secondNumber, 2); 
     Assert.AreEqual(doSomething.myDelimeter, '+'); 
 } 
Esempio n. 2
0
    public void Start()
    {
        ai             = GetComponent <AI>();
        basicTasks     = GetComponent <BasicTasks>();
        animationTasks = GetComponent <AnimationTasks>();
        physics        = GetComponent <Physics>();
        movement       = GetComponent <BasicMovement>();
        gun            = GetComponentInChildren <Gun>();
        particles      = GetComponent <ParticleSystem>();
        pathFinding    = GetComponent <PathFindingTasks>();
        pathFinding.SetMovementParameters(dasherStats.Speed, dasherStats.TurningVelocity);

        var playerBody = GameManager.Instance.Player.GetComponent <Body>();

        targetBody = playerBody.CenterBody;
    }
Esempio n. 3
0
 public Evaluate(BasicTasks _task)
 {
     calculate = _task;
 }
Esempio n. 4
0
 public Evaluate()
 {
     calculate = new BasicTasks();
 }
Esempio n. 5
0
 public Evaluate(BasicTasks _task)
 {
     calculate = _task;
 }
Esempio n. 6
0
 public Evaluate()
 {
     calculate = new BasicTasks();
 }
Esempio n. 7
0
        static void Main(string[] args)
        {
            int counter = 0;
            var propeller = true;
            BasicTasks myOperation = new BasicTasks();


            while (propeller)
            {

                string prompt = "[" + counter + "]" + "> ";

                // Saving user's input expression into a variable
                Console.Write(prompt);
                string theExpression = Console.ReadLine();

                switch (theExpression)
                {
                    // Keyword for exiting application
                    case "quit":
                        Console.WriteLine("Bye!");
                        Environment.Exit(1);
                        return;

                    // Keyword for exiting the application
                    case "exit":
                        Console.WriteLine("Bye!");
                        Environment.Exit(1);
                        return;

                    // User entered "last" command
                    case "last":
                        Console.WriteLine(Stack.LastAnswer);
                        break;

                    // User entered "lastq" command
                    case "lastq":
                        Console.WriteLine(Stack.LastCommand);
                        break;

                    // User entered an expression to be evaluated
                    default:

                        // Stashing this away so it's ready if user enters "lastq" command
                        if (theExpression != "lastq" || theExpression != "last")
                        {
                            Stack.LastCommand = theExpression;
                        }

                        // Finding delimeter
                        myOperation.IdentifyOperator(theExpression);
                        Evaluate evaluating = new Evaluate(myOperation);

                        // Determine if we need to send this on for calculation or constant setting
                        switch (myOperation.myDelimeter)
                        {
                            // Will get set as a constant
                            case '=':
                                myOperation.calcStack.SetTheConstant(myOperation.ifItIsChar, myOperation.secondNumber);
                                break;

                            default:
                                evaluating.EvaluateThis(theExpression);

                                // Increment counter with each round
                                counter = counter + 1;
                                Console.WriteLine("= " + Calculation.Answer);
                                break;
                        }
                        break;
                }
            }
        }
 public void TestEnsureItWillThrowErrorForIncorrectExpression()
 { 
     BasicTasks doSomething = new BasicTasks(); 
     doSomething.IdentifyOperator("3+"); 
 }