public VehicleEventControl(string source, Vehicle vehicle)
        {
            // Create a vehicle event control
            this.vehicle = vehicle;
            index = 0;

            events = new List<int>();

            // Calculate a list of the events the vehicle will have to run
            addEvents(source);
        }
        public Controller(Vehicle v, MemoryBank mb, string pathToSourceCode, string pathToInputs)
        {
            // Create a ByteCollection
            collection = new ByteCollection(pathToSourceCode, 300);
            collection.FilterCode();

            // Create an Interpreter
            interpreter = new Interpreter(pathToInputs, this);
            interpreter.PrepareToRun(collection);

            this.mb = mb;

            // Create a VehicleEventControl
            vec = new VehicleEventControl(interpreter.ExtractBlock(collection), v);
        }
예제 #3
0
        void resetScene()
        {
            for (int i = 0; i < children.Count(); i++)
            {
                if (children[i] is BepuEntity)
                {
                    children.Remove(children[i]);
                    i--;
                }
            }
            space = null;
            space = new Space();
            space.ForceUpdater.Gravity = new Vector3(0, -9.8f, 0);

            groundBox = new Box(Vector3.Zero, ground.width, 0.1f, ground.height);
            groundBox.Material.KineticFriction = 2;
            space.Add(groundBox);

            cameraCylindar = new Cylinder(Camera.Position, 5, 2);
            space.Add(cameraCylindar);

            MemoryBank mb = new MemoryBank(300, new Vector3(0, 2.5f, 0), 8);
            children.Add(mb);

            Vehicle v = new Vehicle(mb, 8.0f);
            //v.FlipTo();

            controller = new Controller(v, mb, program, "input.txt");

            children.Add(v);
        }