Exemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font        = Content.Load <SpriteFont>("Courier New");
            snapshot    = new StateSnapshot();
            soundPlayer.InitSoundLibrary(Content);
            scoreLabel = new TextObject("Score: " + score, font, Color.Black, false);

            t_ball          = this.Content.Load <Texture2D>("Ball");
            t_block         = this.Content.Load <Texture2D>("Block");
            t_paddle        = this.Content.Load <Texture2D>("Paddle");
            WinScreen       = this.Content.Load <Texture2D>("WinScreen");
            LoseScreen      = this.Content.Load <Texture2D>("LoseScreen");
            StartScreen     = this.Content.Load <Texture2D>("StartScreen");
            HighScoreScreen = this.Content.Load <Texture2D>("HighScoreScreen");

            paddle          = new Sprite(t_paddle, new Vector2(0, graphics.GraphicsDevice.Viewport.Height - t_paddle.Height));
            paddle.PhysType = PhysicsTransform.PhysicsType.Solid;

            controller = new SpriteController(paddle);

            console = new Assgn01.Console(graphics.GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height);

            ball = new Sprite(t_ball,
                              new Vector2(graphics.GraphicsDevice.Viewport.Width / 2 - t_ball.Width, graphics.GraphicsDevice.Viewport.Height / 2 - t_ball.Height)
                              , PhysicsTransform.PhysicsType.Elastic, true);
            ball.Velocity = new Vector2(0, 0.3f);

            gameStarted = false;
            gameOver    = true;
            soundPlayer.LoopMusic("BG1");
            //ResetGame();
        }
Exemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            ModelLib.LoadContent(Content, "Models");
            TexLib.LoadContent(Content, "Models\\Textures");

            soundPlayer.InitSoundLibrary(Content);



            //view = new View(this.Window.ClientBounds.Width, this.Window.ClientBounds.Height);
            view = new MazeObjects.Maze();
            //view.Add(new GameObjects.GameObject3D(ModelLib.Get("Ball"), TexLib.Get("EyeTex")));
            // TODO: use this.Content to load your game content here


            effect = Content.Load <Effect>("Shaders\\PerPixelLighting");


            // cache the effect parameters
            cameraPositionParameter    = effect.Parameters["cameraPosition"];
            specularPowerParameter     = effect.Parameters["specularPower"];
            specularIntensityParameter = effect.Parameters["specularIntensity"];
            cameraPositionParameter    = effect.Parameters["cameraPosition"];

            //
            // set up some basic effect parameters that do not change during the
            // course of execution
            //

            // set the light colors
            effect.Parameters["ambientLightColor"].SetValue(new Vector4(255, 255, 255, 0));
            effect.Parameters["diffuseLightColor"].SetValue(Color.Red.ToVector4());
            effect.Parameters["specularLightColor"].SetValue(Color.White.ToVector4());

            // Set the light position to a fixed location.
            // This will place the light source behind, to the right, and above the
            // initial camera position.
            effect.Parameters["lightPosition"].SetValue(
                new Vector3(0f, 1f, 0f));
            effect.Parameters["lightRotation"].SetValue(view.Camera.rotationMatrix);


            effect.Parameters["FullStrengthDistance"].SetValue(0.5f);
            effect.Parameters["MaxDistance"].SetValue(1);

            colChecker = new CollisionChecker(view.GameObject3DList);
            colChecker.CreateBoxes();

            stepCounter = 0;

            soundPlayer.LoopMusic("BG1");
        }