Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.IsMouseVisible = true;
            this.Window.AllowUserResizing = true;

            // Create Services
            this.input = new UserInput(this);
            this.camera = new Camera(this, new Vector3(25f, 25f, 25f),
                new Vector3(-1f, -1f, -1f), Vector3.Up);

            water = new Water(this, Matrix.CreateTranslation(new Vector3(-20, -3, -100)), 122, 122, 2, 8);

            Matrix waterfallTranslate = Matrix.CreateTranslation(new Vector3(5f, 25.5f, -85.5f));
            Matrix waterfallRotate = Matrix.CreateRotationX(MathHelper.PiOver2 - MathHelper.PiOver4 / 4);
            waterfall = new Water(this, waterfallRotate * waterfallTranslate, 20, 40, 0.5f, 8);

            Components.Add(water);
            Components.Add(waterfall);
            Components.Add(this.input);
            Components.Add(this.camera);
            Services.AddService(typeof(ICamera), this.camera);
            Services.AddService(typeof(IInput), this.input);

            hud = new SpriteBatch(this.GraphicsDevice);

            gameOver = false;

            base.Initialize();
        }
Пример #2
0
 //This deviates from standard source(16Nov10). I added an argument for a Camera class object
 public DebugDrawer(Game game, Camera camera)
     : base(game)
 {
     this.vertexData = new List<VertexPositionColor>();
     this.camera = camera;
 }