/// <summary> /// Reload /// </summary> protected override void GetParameters() { // Can't get parameters if loading failed! if (xnaEffect == null) return; windowSize = xnaEffect.Parameters["windowSize"]; sceneMap = xnaEffect.Parameters["sceneMap"]; // We need both windowSize and sceneMap. if (windowSize == null || sceneMap == null) throw new NotSupportedException("windowSize and sceneMap must be " + "valid in PostScreenShader=" + Filename); // Init additional stuff downsampleMap = xnaEffect.Parameters["downsampleMap"]; blurMap1 = xnaEffect.Parameters["blurMap1"]; blurMap2 = xnaEffect.Parameters["blurMap2"]; timer = xnaEffect.Parameters["Timer"]; // Load noise texture for stripes effect noiseMap = xnaEffect.Parameters["noiseMap"]; noiseMapTexture = new Texture("Noise128x128.dds"); // Set texture noiseMap.SetValue(noiseMapTexture.XnaTexture); }
} // IsVisible(point) #endregion #region Occlusion testing (not supported in XNA) /// <summary> /// Occlusion intensity /// </summary> /// <param name="tex">Tex</param> /// <param name="pos">Position</param> /// <param name="size">Size</param> /// <returns>Float</returns> public static float OcclusionIntensity(Texture tex, Point pos, int size) { return 0.0f; } // OcclusionIntensity(tex, pos, size)
/// <summary> /// Run game screen. Called each frame. /// </summary> /// <param name="game">Form for access to asteroid manager and co</param> public void Run(XnaShooterGame game) { // Make sure the textures and models are linked correctly hudTopTexture = game.hudTopTexture; hudBottomTexture = game.hudBottomTexture; landscapeModels = game.landscapeModels; shipModels = game.shipModels; itemModels = game.itemModels; // Render landscape, ships and neutral objects RenderLevelBackground( //tst: 30+ Player.gameTimeMs / 64.0f);//66.0f);//33.0f); // Handle game logic, move player around, weapons, collisions, etc. Player.HandleGameLogic(this); // Handle effect stuff BaseGame.effectManager.HandleAllEffects(); // Render hud on top of 3d stuff RenderHud(); // End game if escape was pressed or game is over and space or mouse // button was pressed. if (Input.KeyboardEscapeJustPressed || Input.GamePadBackJustPressed || (Player.GameOver && (Input.KeyboardSpaceJustPressed || Input.GamePadAJustPressed || Input.GamePadBJustPressed || Input.GamePadXJustPressed || Input.GamePadXJustPressed || Input.MouseLeftButtonJustPressed))) { // Upload new highscore (as we currently are in game, // no bonus or anything will be added, this score is low!) Player.SetGameOverAndUploadHighscore(); // Reset camera to origin and notify we are not longer in game mode XnaShooterGame.camera.SetPosition(Vector3.Zero); // Quit to the main menu quit = true; } // if }
public void Load() { // Load textures if (effectTextures == null) { effectTextures = new Texture[EffectTextureFilenames.Length]; for (int num = 0; num < effectTextures.Length; num++) { effectTextures[num] = new Texture(EffectTextureFilenames[num]); } // for (num) } // if if (explosionTextures == null) { explosionTextures = new AnimatedTexture[ExplosionTextureFilenames.Length]; for (int num = 0; num < explosionTextures.Length; num++) { explosionTextures[num] = new AnimatedTexture( ExplosionTextureFilenames[num]); } // for (num) } // if }
/// <summary> /// Allows the game to perform any initialization it needs. /// </summary> protected override void Initialize() { base.Initialize(); // Make sure mouse is centered Input.Update(); Input.MousePos = new Point( Window.ClientBounds.X + width / 2, Window.ClientBounds.Y + height / 2); Input.Update(); // Load menu textures mainMenuTexture = new Texture("MainMenu"); mouseCursorTexture = new Texture("MouseCursor"); hudTopTexture = new Texture("HudTop"); hudBottomTexture = new Texture("HudBottom"); // Load explosion effect //explosionTexture = new AnimatedTexture("Destroy"); // Load background landscape and wall models landscapeModels = new Model[] { new Model("BackgroundGround"), new Model("Building"), new Model("Building2"), new Model("Building3"), new Model("Building4"), new Model("Building5"), new Model("Kaktus"), new Model("Kaktus2"), new Model("KaktusBenny"), new Model("KaktusSeg"), }; shipModels = new Model[] { new Model("OwnShip"), new Model("Corvette"), new Model("SmallTransporter"), new Model("Firebird"), new Model("RocketFrigate"), new Model("Rocket"), new Model("Asteroid"), }; itemModels = new Model[] { new Model("ItemHealth"), new Model("ItemMg"), new Model("ItemGattling"), new Model("ItemPlasma"), new Model("ItemRockets"), new Model("ItemEmp"), }; // Create main menu screen gameScreens.Push(new MainMenu()); // Start game //gameScreens.Push(new Mission()); //inGame = true; // Start music Sound.StartMusic(); }
/// <summary> /// Reload /// </summary> protected override void GetParameters() { // Can't get parameters if loading failed! if (xnaEffect == null) return; windowSize = xnaEffect.Parameters["windowSize"]; sceneMap = xnaEffect.Parameters["sceneMap"]; // We need both windowSize and sceneMap. if (windowSize == null || sceneMap == null) throw new NotSupportedException("windowSize and sceneMap must be " + "valid in PostScreenShader=" + Filename); // Load screen border texture screenBorderFadeoutMap = xnaEffect.Parameters["screenBorderFadeoutMap"]; screenBorderFadeoutMapTexture = new Texture("ScreenBorderFadeout.dds"); // Set texture screenBorderFadeoutMap.SetValue( screenBorderFadeoutMapTexture.XnaTexture); }