Exemplo n.º 1
0
        /// <summary>
        /// Creates a reflection textureCube
        /// </summary>
        static TextureCube GetReflectCube()
        {
            if (reflectCube != null)
            {
                return(reflectCube);
            }

            Color[] cc = new Color[]
            {
                new Color(1, 0, 0), new Color(0.9f, 0, 0.1f),
                new Color(0.8f, 0, 0.2f), new Color(0.7f, 0, 0.3f),
                new Color(0.6f, 0, 0.4f), new Color(0.5f, 0, 0.5f),
                new Color(0.4f, 0, 0.6f), new Color(0.3f, 0, 0.7f),
                new Color(0.2f, 0, 0.8f), new Color(0.1f, 0, 0.9f),
                new Color(0.1f, 0, 0.9f), new Color(0.0f, 0, 1.0f),
            };

            reflectCube = new TextureCube(ShipGameGame.GetInstance().GraphicsDevice,
                                          8, true, SurfaceFormat.Color);

            Random rand = new Random();

            for (int s = 0; s < 6; s++)
            {
                Color[] sideData = new Color[reflectCube.Size * reflectCube.Size];
                for (int i = 0; i < sideData.Length; i++)
                {
                    sideData[i] = cc[rand.Next(cc.Length)];
                }
                reflectCube.SetData((CubeMapFace)s, sideData);
            }

            return(reflectCube);
        }
Exemplo n.º 2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            using (ShipGameGame game = new ShipGameGame())

            #endregion


            {
                instance = game;
                game.Run();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Performs effect initialization, which is required in XNA 4.0
        /// </summary>
        /// <param name="model"></param>
        private void FixupShip(Model model, string path)
        {
            ShipGameGame game = ShipGameGame.GetInstance();

            foreach (ModelMesh mesh in model.Meshes)
            {
                // for each mesh part
                foreach (Effect effect in mesh.Effects)
                {
                    //effect.Parameters["Reflect"].SetValue(GetReflectCube());
                }
            }
        }
Exemplo n.º 4
0
        public ShipGameGame()
        {
            instance = this;
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            audioEngine = new AudioEngine("Content/sounds/sounds.xgs");
            waveBank    = new WaveBank(audioEngine, "Content/sounds/Wave Bank.xwb");
            soundBank   = new SoundBank(audioEngine, "Content/sounds/Sound Bank.xsb");

            game = new GameManager(soundBank);

            graphics.PreferredBackBufferWidth  = GameOptions.ScreenWidth;
            graphics.PreferredBackBufferHeight = GameOptions.ScreenHeight;

            //graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;
            //graphics.MinimumVertexShaderProfile = ShaderProfile.VS_1_1;

            IsFixedTimeStep = renderVsync;
            graphics.SynchronizeWithVerticalRetrace = renderVsync;
        }
Exemplo n.º 5
0
        float backgroundTime = 0.0f;  // time for background animation used on menus

        // constructor
        public ScreenManager(ShipGameGame shipGame, FontManager font, GameManager game)
        {
            this.shipGame = shipGame;
            gameManager = game;
            fontManager = font;

            screens = new List<Screen>();
            inputManager = new InputManager();

            // add all screens
            screens.Add(new ScreenIntro(this, game));
            screens.Add(new ScreenHelp(this, game));
            screens.Add(new ScreenPlayer(this, game));
            screens.Add(new ScreenLevel(this, game));
            screens.Add(new ScreenGame(this, game));
            screens.Add(new ScreenEnd(this, game));

            // fade in to intro screen
            SetNextScreen(ScreenType.ScreenIntro,
                GameOptions.FadeColor, GameOptions.FadeTime);
            fade = fadeTime * 0.5f;
        }
Exemplo n.º 6
0
        float backgroundTime = 0.0f;     // time for background animation used on menus

        // constructor
        public ScreenManager(ShipGameGame shipGame, FontManager font, GameManager game)
        {
            this.shipGame = shipGame;
            gameManager   = game;
            fontManager   = font;

            screens      = new List <Screen>();
            inputManager = new InputManager();

            // add all screens
            screens.Add(new ScreenIntro(this, game));
            screens.Add(new ScreenHelp(this, game));
            screens.Add(new ScreenPlayer(this, game));
            screens.Add(new ScreenLevel(this, game));
            screens.Add(new ScreenGame(this, game));
            screens.Add(new ScreenEnd(this, game));

            // fade in to intro screen
            SetNextScreen(ScreenType.ScreenIntro,
                          GameOptions.FadeColor, GameOptions.FadeTime);
            fade = fadeTime * 0.5f;
        }
Exemplo n.º 7
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            using (ShipGameGame game = new ShipGameGame())

#endregion


            {
                instance = game;
                game.Run();
            }
        }