Esempio n. 1
0
        protected override void LoadContent()
        {
            Window.Position = new Point(10, 50);
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            background = Content.Load <Texture2D>("Textures/background");
            stone      = Content.Load <Texture2D>("Textures/stone");
            eva        = Content.Load <Texture2D>("Textures/eva");
            pix        = Content.Load <Texture2D>("Textures/pix");
            taxiSign   = Content.Load <Texture2D>("Textures/taxisign");
            flag       = Content.Load <Texture2D>("Textures/flag");
            hudFont    = Content.Load <SpriteFont>("HudFont");

            taxiTextures.Add(Content.Load <Texture2D>("Textures/taxi_blue"));
            taxiTextures.Add(Content.Load <Texture2D>("Textures/taxi_red"));
            taxiTextures.Add(Content.Load <Texture2D>("Textures/taxi_yellow"));
            taxiTextures.Add(Content.Load <Texture2D>("Textures/taxi_green"));

            playerColor.Add(Color.Blue);
            playerColor.Add(Color.Red);
            playerColor.Add(Color.Yellow);
            playerColor.Add(Color.Green);

            Random    rand = new Random();
            Texture2D buffer;
            Color     colorBuffer;

            for (int i = 0; i < 100; i++)
            {
                int from = rand.Next(0, 4);
                int to   = rand.Next(0, 4);

                buffer             = taxiTextures[from];
                taxiTextures[from] = taxiTextures[to];
                taxiTextures[to]   = buffer;

                colorBuffer       = playerColor[from];
                playerColor[from] = playerColor[to];
                playerColor[to]   = colorBuffer;
            }

            Taxi taxi1 = new Taxi(new LocalInput(LocalInputType.GamePad1));

            taxi1.Position = level.GetTaxiSpawn();
            taxis.Add(taxi1);
            sound.AddTaxi(taxi1);

            Taxi taxi2 = new Taxi(new LocalInput(LocalInputType.Keyboard1));

            taxi2.Position = level.GetTaxiSpawn();
            taxis.Add(taxi2);
            sound.AddTaxi(taxi2);
        }