/// <summary>
        ///     Inicio todos los objetos necesarios para cargar el ejemplo y directx.
        /// </summary>
        public void InitGraphics()
        {
            //Se inicio la aplicación
            ApplicationRunning = true;

            //Inicio Device
            D3DDevice.Instance.InitializeD3DDevice(panel3D);

            //Inicio inputs
            Input = new TgcD3dInput();
            Input.Initialize(this, panel3D);

            //Inicio sonido
            DirectSound = new TgcDirectSound();
            DirectSound.InitializeD3DDevice(panel3D);

            //Directorio actual de ejecución
            var currentDirectory = Environment.CurrentDirectory + "\\";

            //Cargar shaders del framework
            TGCShaders.Instance.LoadCommonShaders(currentDirectory + Game.Default.ShadersDirectory, D3DDevice.Instance);

            //Juego a ejecutar, si quisiéramos tener diferentes modelos aquí podemos cambiar la instancia e invocar a otra clase.
            //Modelo = new GameModel(currentDirectory + Game.Default.MediaDirectory,
            //    currentDirectory + Game.Default.ShadersDirectory);

            Modelo = new UnderseaModel(currentDirectory + Game.Default.MediaDirectory,
                                       currentDirectory + Game.Default.ShadersDirectory);

            //Cargar juego.
            ExecuteModel();
        }
 protected CustomModel(UnderseaModel gameModel,
                       TgcCamera camera,
                       TgcD3dInput input,
                       string mediaDir,
                       string shadersDir,
                       TgcFrustum frustum,
                       TgcText2D drawText)
 {
     GameModel  = gameModel;
     Camera     = camera;
     Input      = input;
     MediaDir   = mediaDir;
     ShadersDir = shadersDir;
     Frustum    = frustum;
     DrawText   = drawText;
 }
Exemple #3
0
        public Level1Model(UnderseaModel gameModel, TgcCamera camera, TgcD3dInput input, string mediaDir, string shadersDir, TgcFrustum frustum, TgcText2D drawText, TgcDirectSound directSound)
            : base(gameModel, camera, input, mediaDir, shadersDir, frustum, drawText)
        {
            hudModel = new HUDModel(MediaDir, D3DDevice.Instance.Device);

            initialLookAt   = new TGCVector3(6000, 4120f, 6600f);
            initialPosition = new TGCVector3(6000, 4120f, 6600f);

            //Camara
            Camera = new FpsCamera(initialLookAt, Input);

            //Player
            playerModel = new PlayerModel(surfacePosition.Y, initialPosition, gameModel, Camera, input, mediaDir, shadersDir, frustum, drawText, directSound);

            //Collect Model
            collectModel = new CollectModel(gameModel, Camera, input, mediaDir, shadersDir, frustum, drawText, directSound);

            // History Model
            historyModel = new HistoryModel(gameModel, Camera, input, mediaDir, shadersDir, frustum, drawText);

            // You Win Model
            youWinModel = new YouWinModel(gameModel, Camera, input, mediaDir, shadersDir, frustum, drawText, directSound);
        }