Пример #1
0
 public ModelManager(Game game)
     : base(game)
 {
     this.models = new List<BasicModel>();
     this.input = ((ISTestGame)this.Game).input;
     this.physDebug = ((ISTestGame)this.Game).physDebug;
 }
Пример #2
0
 public Camera(Game game, Vector3 pos, Vector3 dir, Vector3 up)
     : base(game)
 {
     this.pos = pos;
     this.dir = dir;
     this.dir.Normalize();
     this.up = up;
     float aspectRatio = Game.Window.ClientBounds.Width / Game.Window.ClientBounds.Height;
     this.projection = Matrix.CreatePerspectiveFieldOfView(
         MathHelper.PiOver4, aspectRatio, 1, 700);
     CreateLookAt();
     this.input = ((ISTestGame)game).input;
     this.normalLight = true;
 }
Пример #3
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();
        }