コード例 #1
0
 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, '+'); 
 } 
コード例 #2
0
ファイル: DasherTasks.cs プロジェクト: scottbass47/gsts
    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;
    }
コード例 #3
0
ファイル: Evaluate.cs プロジェクト: LandoB/ConsoleCalculator
 public Evaluate(BasicTasks _task)
 {
     calculate = _task;
 }
コード例 #4
0
ファイル: Evaluate.cs プロジェクト: LandoB/ConsoleCalculator
 public Evaluate()
 {
     calculate = new BasicTasks();
 }
コード例 #5
0
 public Evaluate(BasicTasks _task)
 {
     calculate = _task;
 }
コード例 #6
0
 public Evaluate()
 {
     calculate = new BasicTasks();
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: LandoB/ConsoleCalculator
        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;
                }
            }
        }
コード例 #8
0
 public void TestEnsureItWillThrowErrorForIncorrectExpression()
 { 
     BasicTasks doSomething = new BasicTasks(); 
     doSomething.IdentifyOperator("3+"); 
 }