public override void initialize(string data) { this.alpha = 0; this.returnData = ""; this.timer = 0.0; this.cleansed = new Sprite(spriteBatch, game, Constants.GUI_LEVEL_CLEANSED); cleansedOffset = cleansed.Dimension * 0.5f; levelManager = new LevelManager(); entityManager = new EntityManager(spriteBatch, game, audio, levelManager); player = new Player(spriteBatch, game, audio, "player", entityManager, controls); Vector2 newPlayerPos = new Vector2((float)Constants.RESOLUTION_VIRTUAL_WIDTH - 200f, (float)Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f); player.Position = newPlayerPos; entityManager.addEntity(player); entityManager.initialize(); Level level = new Level(spriteBatch, game, audio, entityManager, player, controls, Constants.LEVEL01, "level01"); levelManager.AddLevel(level); level = new Level(spriteBatch, game, audio, entityManager, player, controls, Constants.LEVEL02, "level02"); levelManager.AddLevel(level); level = new Level(spriteBatch, game, audio, entityManager, player, controls, Constants.LEVEL03, "level03"); levelManager.AddLevel(level); levelManager.setLevel(data); levelComplete = false; secondFade = new FadeInOut(spriteBatch, game); secondFade.Reset(); secondFade.alphaValue = 1; fade = new FadeInOut(spriteBatch, game); fade.Reset(); fade.FadeIn(); audio.playMusic("main_music"); }
public override void initialize(string data) { bg = new Sprite(spriteBatch, game, Constants.SPLASH_SCREEN_FILENAME); fade = new FadeInOut(spriteBatch, game); //audio.playMusic(Constants.AUDIO_INTRO); audio.playSound("intro_startup"); fade.FadeIn(); }
public override void initialize(string data) { this.pressStartOnce = false; glowList = new List<GlowParticle>(); nextState = ""; bg = new Sprite(spriteBatch, game, Constants.MENU_COMBINED_BG_COLORMAP); bg_normal = new Sprite(spriteBatch, game, Constants.MENU_COMBINED_BG_NORMALMAP); bg_front = new Sprite(spriteBatch, game, Constants.MENU_FRONT_BG_COLORMAP); bg_front_normal = new Sprite(spriteBatch, game, Constants.MENU_FRONT_BG_NORMALMAP); bg_spikes = new Sprite(spriteBatch, game, Constants.MENU_SPIKES_BG_COLORMAP); fog = new Sprite(spriteBatch, game, "Backgrounds\\background__0002s_0001_Layer-8"); logo = new Sprite(spriteBatch, game, "GUI\\logo_SOUL"); fade = new FadeInOut(spriteBatch, game); audio.playMusic("menu_music"); glowFX = new GlowFX(game); menuStateManager = new MenuStateManager(spriteBatch, game, graphics, displayModes, controls, audio); menuStateManager.Initialize(); spriteFont = game.Content.Load<SpriteFont>(Constants.GUI_FONT); askToQuit = new MenuManager(controls, "askToQuit"); ImageButton button = new ImageButton(spriteBatch, game, controls, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f - 300, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), Constants.GUI_YES, "quit_yes"); Label label = new Label(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f), "quit_text", "Are you sure you want to quit?", false); button.onClick += new ImageButton.ButtonEventHandler(QuitConfirm); askToQuit.AddButton(button, label); button = new ImageButton(spriteBatch, game, controls, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), Constants.GUI_NO, "quit_no"); button.onClick += new ImageButton.ButtonEventHandler(QuitConfirm); askToQuit.AddButton(button); askToQuit.initialize(); #region InitializeLighting PresentationParameters pp = game.GraphicsDevice.PresentationParameters; //int width = Constants.RESOLUTION_VIRTUAL_WIDTH; //int height = Constants.RESOLUTION_VIRTUAL_HEIGHT; int width = pp.BackBufferWidth; int height = pp.BackBufferHeight; SurfaceFormat format = pp.BackBufferFormat; Vertices = new VertexPositionColorTexture[4]; Vertices[0] = new VertexPositionColorTexture(new Vector3(-1, 1, 0), Color.White, new Vector2(0, 0)); Vertices[1] = new VertexPositionColorTexture(new Vector3(1, 1, 0), Color.White, new Vector2(1, 0)); Vertices[2] = new VertexPositionColorTexture(new Vector3(-1, -1, 0), Color.White, new Vector2(0, 1)); Vertices[3] = new VertexPositionColorTexture(new Vector3(1, -1, 0), Color.White, new Vector2(1, 1)); VertexBuffer = new VertexBuffer(game.GraphicsDevice, typeof(VertexPositionColorTexture), Vertices.Length, BufferUsage.None); VertexBuffer.SetData(Vertices); colorMap = new RenderTarget2D(game.GraphicsDevice, width, height); normalMap = new RenderTarget2D(game.GraphicsDevice, width, height); shadowMap = new RenderTarget2D(game.GraphicsDevice, width, height, false, format, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents); lightEffect = game.Content.Load<Effect>("Shaders\\MultiTarget"); lightCombinedEffect = game.Content.Load<Effect>("Shaders\\DeferredCombined"); lightEffectTechniquePointLight = lightEffect.Techniques["DeferredPointLight"]; lightEffectParameterConeDirection = lightEffect.Parameters["coneDirection"]; lightEffectParameterLightColor = lightEffect.Parameters["lightColor"]; lightEffectParameterLightDecay = lightEffect.Parameters["lightDecay"]; lightEffectParameterNormalMap = lightEffect.Parameters["NormalMap"]; lightEffectParameterPosition = lightEffect.Parameters["lightPosition"]; lightEffectParameterScreenHeight = lightEffect.Parameters["screenHeight"]; lightEffectParameterScreenWidth = lightEffect.Parameters["screenWidth"]; lightEffectParameterStrenght = lightEffect.Parameters["lightStrength"]; lightCombinedEffectTechnique = lightCombinedEffect.Techniques["DeferredCombined2"]; lightCombinedEffectParamAmbient = lightCombinedEffect.Parameters["ambient"]; lightCombinedEffectParamLightAmbient = lightCombinedEffect.Parameters["lightAmbient"]; lightCombinedEffectParamAmbientColor = lightCombinedEffect.Parameters["ambientColor"]; lightCombinedEffectParamColorMap = lightCombinedEffect.Parameters["ColorMap"]; lightCombinedEffectParamShadowMap = lightCombinedEffect.Parameters["ShadingMap"]; lightCombinedEffectParamNormalMap = lightCombinedEffect.Parameters["NormalMap"]; #endregion InitializeLighting /*PointLight light = new PointLight() { Color = new Vector4(1f, 1f, 1f, 1f), Power = 8f, LightDecay = 300, Position = new Vector3(200f, 400f, 50f), IsEnabled = true }; lights.Add(light);*/ random = new Random(); fade.FadeIn(); }