Ejemplo n.º 1
0
        // --------------------------------------------------------------------------
        // CONSTRUCTOR
        // --------------------------------------------------------------------------
        public CircuitRenderer(NXTCircuit circuit, GraphicsDevice graphicsDevice)
        {
            this.circuit = circuit;

            tStraight = RenderTools.LoadTextureFromFile(graphicsDevice, "Data\\droit.png");
            tTurn     = RenderTools.LoadTextureFromFile(graphicsDevice, "Data\\virage.png");
            tIntersec = RenderTools.LoadTextureFromFile(graphicsDevice, "Data\\intersection.png");
        }
Ejemplo n.º 2
0
 public IA(NXTVehicule p_vehicule, bool p_simulation = false)
 {
     this.vehicule = p_vehicule;
     this.circuit  = vehicule.Circuit;
     this.buffer   = p_vehicule.Buffer;
     pStraight     = new NXTAction(NXTMovement.STRAIGHT);
     pLeft         = new NXTAction(NXTMovement.INTER_LEFT);
     pRight        = new NXTAction(NXTMovement.INTER_RIGHT);
     pUturn        = new NXTAction(NXTMovement.UTURN);
 }
Ejemplo n.º 3
0
        // --------------------------------------------------------------------------
        // METHODS
        // --------------------------------------------------------------------------

        // Initialise le Circuit, le CircuitRenderer, la Camera et le Cursor
        public void InitializeCircuit(NXTCircuit c = null)
        {
            if (c != null)
            {
                this.circuit = c;
            }

            tPixel = new Texture2D(this.GraphicsDevice, 1, 1);
            tPixel.SetData <Color>(new Color[] { Color.White });

            cRend       = new CircuitRenderer(circuit, this.GraphicsDevice);
            cursor      = new Cursor(cRend, tPixel);
            camera      = new Camera(this.GraphicsDevice.Viewport);
            initialized = true;
        }
Ejemplo n.º 4
0
        private void LoadCircuit(string path)
        {
            Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read);
            XmlDictionaryReader    reader = XmlDictionaryReader.CreateTextReader(stream, new XmlDictionaryReaderQuotas());
            DataContractSerializer ser    = new DataContractSerializer(typeof(NXTCircuit));

            NXTCircuit c = (NXTCircuit)ser.ReadObject(reader, true);

            reader.Close();
            stream.Close();

            this.circuit = c;

            if (this.drawEditor1 != null)
            {
                this.drawEditor1.InitializeCircuit(this.circuit);
            }
        }
Ejemplo n.º 5
0
        private void NewCircuit()
        {
            NewCircuitDialog d = new NewCircuitDialog();

            d.ShowDialog();

            if (d.AlreadyInstanced)
            {
                LoadCircuit(d.Nom);
            }
            else
            {
                circuit     = new NXTCircuit(d.CWidth, d.CHeight);
                circuit.Nom = d.Nom;
            }

            if (d.CloseAfterLoad)
            {
                this.Close();
            }
        }
Ejemplo n.º 6
0
 // --------------------------------------------------------------------------
 // CONSTRUCTOR
 // --------------------------------------------------------------------------
 public DrawEditor(NXTCircuit circuit)
     : base()
 {
     this.circuit = circuit;
     oldKeyState  = new KeyboardState();
 }