/// <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() { // TODO: Add your initialization logic here //Guide.SimulateTrialMode = true; // Inicializamos el TLSA.Engine: Manager.Initialize(this, graphics); // Inicializamos el motor grafico: { Manager.Graphics.SetDisplayMode(PrefDisplayModes._720p); Manager.Graphics.SynchronizeWithVerticalRetrace = true; Manager.Graphics.ClearColor = Color.Black; Manager.Graphics.LoadShader(@"Shaders\GreyScale"); } // Inicializamos la instancia global del motor de fisicas: { Rectangle workArea = Manager.Graphics.ScreenBounds; workArea.X -= 16; workArea.Y -= 16; workArea.Width += 32; workArea.Height += 32; Manager.PhysicEngine.WorkArea = workArea; Manager.PhysicEngine.Gravity = new Vector2(0, 9); //Manager.PhysicEngine.Visible = true; } // Inicializamos el gestor de eventos de entrada: Manager.UIInput.SelectedDevice = InputType.GamePad; // Mapa de input del juego, se usara tambien para la GUI: { Manager.UIInput.Actions.Add("left", new InputAction(Keys.Left, null, Buttons.LeftThumbstickLeft)); Manager.UIInput.Actions.Add("right", new InputAction(Keys.Right, null, Buttons.LeftThumbstickRight)); Manager.UIInput.Actions.Add("down", new InputAction(Keys.Down, null, Buttons.LeftThumbstickDown)); Manager.UIInput.Actions.Add("up", new InputAction(Keys.Up, null, Buttons.LeftThumbstickUp)); Manager.UIInput.Actions.Add("menu_left", new InputAction(Keys.Left, null, Buttons.DPadLeft)); Manager.UIInput.Actions.Add("menu_right", new InputAction(Keys.Right, null, Buttons.DPadRight)); Manager.UIInput.Actions.Add("menu_down", new InputAction(Keys.Down, null, Buttons.DPadDown)); Manager.UIInput.Actions.Add("menu_up", new InputAction(Keys.Up, null, Buttons.DPadUp)); Manager.UIInput.Actions.Add("jump", new InputAction(Keys.LeftControl, null, Buttons.A)); Manager.UIInput.Actions.Add("crouch", new InputAction(Keys.Down, null, Buttons.LeftTrigger)); Manager.UIInput.Actions.Add("switch", new InputAction(Keys.LeftShift, null, Buttons.X)); Manager.UIInput.Actions.Add("shoot", new InputAction(Keys.Space, null, Buttons.RightTrigger)); Manager.UIInput.Actions.Add("pause", new InputAction(Keys.Escape, null, Buttons.Start)); Manager.UIInput.Actions.Add("ok", new InputAction(Keys.Enter, null, Buttons.Start)); Manager.UIInput.Actions.Add("exit", new InputAction(Keys.Escape, null, Buttons.B)); Manager.UIInput.Actions.Add("grey", new InputAction(Keys.F1, null, Buttons.LeftShoulder)); Manager.UIInput.Actions.Add("phyx", new InputAction(Keys.F2, null, Buttons.RightShoulder)); } // Variables globales: { Manager.Vars.Create("currentLevel", 1); Manager.Vars.Create("lastLevel", 1); Manager.Vars.Create("loadSaveGame", false); Manager.Vars.Create("firstGame", true); Manager.Vars.Create("CMYK_Ammo", 0); // Contador de municion del arma CMYK. Manager.Vars.Create("prev_CMYK_Ammo", 0); Manager.Vars.Create("errorBoard", ""); Manager.Vars.Create("showMessageReady", true); // Indica si se mostrara el mensaje de inicio de partida. Manager.Vars.Create("showMessageDead", false); // Indica si se muestra el mensaje de muerte. Manager.Vars.Create("showMessagePause", false); // Indica si se muestra el mensaje de pausa. Manager.Vars.Create("score", 0); // Contador de puntuacion. Manager.Vars.Create("setGameState", ""); Manager.Vars.Create("creditsFromEndGame", false); Manager.Vars.Create("purchaseAndReturnMenu", false); Manager.Vars.Create("gamepadLost", false); } // Estados del juego: { Manager.GameStates.States.Add("splash", new GameObjects.States.SplashScreen()); Manager.GameStates.States.Add("menu", new GameObjects.States.Menu()); Manager.GameStates.States.Add("levelSelection", new GameObjects.States.LevelSelection()); Manager.GameStates.States.Add("game", new GameObjects.States.Game()); Manager.GameStates.States.Add("credits", new GameObjects.States.Credits()); Manager.GameStates.States.Add("options", new GameObjects.States.Options()); Manager.GameStates.States.Add("gametitle", new GameObjects.States.GameTitle()); Manager.GameStates.States.Add("intro", new GameObjects.States.Intro()); Manager.GameStates.States.Add("gameover", new GameObjects.States.GameOver()); Manager.GameStates.States.Add("endtrial", new GameObjects.States.EndTrial()); Manager.GameStates.ChangeState("splash"); } StorageSession.Initialize(); base.Initialize(); }