Ejemplo n.º 1
0
        public Passus (CompositorColorCorrectionNode colorCorrectionNode,
            GameState state, AIManager aiManager, RendererContext rendererContext)
        {
            passusEmitter = new PassusGhostParticleEmitter ();

            PassusGameState = state;

            particlePassus = new ParticleSceneObject (passusEmitter.ParticleCount);
            particlePassus.Priority = 7001;
            state.Scene.AddObject (particlePassus);
            passusEmitter.Init (particlePassus, rendererContext);

            PassusEntity = EntityFactory.Instance.CreateWith ("Passus." + InstanceCount++, state.MessageProxy,
                new[] { typeof (ArtificialIntelligenceComponent) },
                new[] { typeof (ParticleSystem), typeof (PhysicsSystem) });

            PassusEntity.GetComponent<ParticleComponent> ().Emitter = passusEmitter;
            PassusEntity.GetComponent<ParticleComponent> ().Particle = particlePassus;

            RigidBody passusBody = new RigidBody (new SphereShape (1.2f));
            passusBody.AffectedByGravity = false;
            passusBody.AllowDeactivation = false;
            passusBody.Mass = 20;
            PassusEntity.GetComponent<PhysicsComponent> ().RigidBody = passusBody;
            PassusEntity.GetComponent<PhysicsComponent> ().World = state.PhysicsManager.World;
            PassusEntity.GetComponent<PhysicsComponent> ().PhysicsApplying = AffectedByPhysics.Position;

            state.PhysicsManager.World.AddBody (passusBody);

            var AIcomp = PassusEntity.GetComponent<ArtificialIntelligenceComponent>();
            AIcomp.AIManager = aiManager;
            AIcomp.ArtificialIntelligence = new PassusAI (PassusEntity, state, colorCorrectionNode);
            aiManager.RegisterEntity (PassusEntity);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        /// <param name="args">The command-line arguments.</param>
        public static void Main (string[] args)
        {
            Application.Instance = new Application ("No Way Out", args);
            Application.Instance.Init ();
            Application.Instance.Load ();

            Application.Instance.AudioManager.LoadSound ("main_menu_Sound", "Content/Audio/main_menu.ogg");
            MainMenuMusic = Application.Instance.AudioManager.CreateSource ("main_menu_SoundSource", "main_menu_Sound");
            MainMenuMusic.Loop = true;
            MainMenuMusic.Gain = 0.6f;

            MainMenuMusic.Play ();

            MazeTest maze = null;
            if (!Application.Instance.IsCommandLineInterface)
            {
                Content.Game game = Application.Instance.Game;
                var rc = Application.Instance.RendererContext;
                var messageManager = Application.Instance.MessageManager;
                var objmnr = Application.Instance.ObjectManager;

                var compositor = new BasicCompositor (objmnr, rc);

                var sceneNode = new CompositorNodeScene (rc, messageManager);
                var outputNode = new CompositorNodeOutput (rc, messageManager);
                var colorCorrectionNode = new CompositorColorCorrectionNode (rc, messageManager);
                var healthOverlayNode = new CompositorImageOverlayNode (rc, messageManager);
                var warpingNode = new CompositorWarpingNode (rc, messageManager);

                compositor.AddNode (sceneNode);
                compositor.AddNode (outputNode);
                compositor.AddNode (healthOverlayNode);
                compositor.AddNode (colorCorrectionNode);
                compositor.AddNode (warpingNode);

                compositor.AddConnection (sceneNode, healthOverlayNode, 0, 0);
                compositor.AddConnection (healthOverlayNode, colorCorrectionNode, 0, 0);
                compositor.AddConnection (colorCorrectionNode, warpingNode, 0, 0);
                compositor.AddConnection (warpingNode, outputNode, 0, 0);

                rc.Compositor = compositor;

                new MainMenu(Application.Instance, () => {
                    outputNode.EnableUI = false;
                    maze = new MazeTest(messageManager, objmnr, rc, game, Application.Instance, sceneNode,
                        healthOverlayNode, colorCorrectionNode, outputNode, warpingNode);
                    outputNode.EnableUI = true;
                    maze.Generate();
                }, colorCorrectionNode);
            }

            Application.Instance.Run ();
            if (maze != null)
                maze.Destroy ();
            Application.Instance.Destroy ();
        }
Ejemplo n.º 3
0
        public ViridionAI (Entity entity, GameState state, CompositorColorCorrectionNode colorCorrectionNode)
        {
            this.colorCorrectionNode = colorCorrectionNode;
            this.entity = entity;
            gameState = state;
            AIcomp = entity.GetComponent<ArtificialIntelligenceComponent>();

            Provider = state.MessageProxy;
            Provider += this;
        }
Ejemplo n.º 4
0
        public PauseMenu (Application app, CompositorColorCorrectionNode colorCorrectionNode, Base parent,
            Action onContinue, Action onPause)
        {
            this.onContinue = onContinue;
            this.onPause = onPause;
            this.colorCorrectionNode = colorCorrectionNode;
            this.application = app;
            this.parent = parent;

            settings = new SettingsMenu (app, parent, colorCorrectionNode);

            window = new WindowControl (parent, Localizer.Instance.GetValueForName("pause"));
            window.DisableResizing();
            window.IsMoveable = false;
            window.OnClose += (sender, arguments) => Hide();
            window.Width = BUTTON_WIDTH + 20;
            window.Hide();

            continueButton = new Button (window);
            continueButton.Text = Localizer.Instance.GetValueForName("back_to_game");
            continueButton.Width = BUTTON_WIDTH;
            continueButton.X = 10;
            continueButton.Y = 10;
            continueButton.Clicked += (sender, arguments) => Hide();

            settingsButton = new Button (window);
            settingsButton.Text = Localizer.Instance.GetValueForName("settings");
            settingsButton.Width = BUTTON_WIDTH;
            settingsButton.X = 10;
            settingsButton.Y = 10 + continueButton.Y + continueButton.Height;
            settingsButton.Clicked += (sender, arguments) => settings.Show();

            exitButton = new Button (window);
            exitButton.Text = Localizer.Instance.GetValueForName("quit_game");
            exitButton.Width = BUTTON_WIDTH;
            exitButton.X = 10;
            exitButton.Y = 10 + settingsButton.Y + settingsButton.Height;
            exitButton.Clicked += (sender, arguments) => application.Window.Close ();

            window.Height += exitButton.Y + exitButton.Height + 10;
            window.X = (parent.Width - window.Width) / 2;
            window.Y = (parent.Height - window.Height) / 2;

            ValidMessages = new int[] { (int) MessageId.WindowResize, (int) MessageId.UpdateLocale,
                (int) MessageId.Input };

            app.MessageManager += this;
        }
Ejemplo n.º 5
0
        public Viridion (GameState state, AIManager aiManager, RendererContext rendererContext,
            CompositorColorCorrectionNode colorCorrectionNode)
        {
            viridionEmitter = new ViridionParticleEmitter ();

            ViridionGameState = state;

            particleViridion = new ParticleSceneObject (viridionEmitter.ParticleCount);
            particleViridion.Priority = 7002;
            state.Scene.AddObject (particleViridion);
            viridionEmitter.Init (particleViridion, rendererContext);

            ViridionEntity = EntityFactory.Instance.CreateWith ("Viridion." + InstanceCount++, state.MessageProxy,
                new[] { typeof (ArtificialIntelligenceComponent) },
                new[] { typeof (ParticleSystem), typeof (PhysicsSystem), typeof(LightSystem) });

            ViridionEntity.GetComponent<ParticleComponent> ().Emitter = viridionEmitter;
            ViridionEntity.GetComponent<ParticleComponent> ().Particle = particleViridion;

            var light = ViridionEntity.GetComponent<LightComponent> ().Light;
            light = new FreezingArcher.Renderer.Scene.Light (FreezingArcher.Renderer.Scene.LightType.PointLight);
            light.On = true;
            light.Color = new FreezingArcher.Math.Color4 (0.6f, 0.6f, 0.6f, 1.0f);
            light.PointLightLinearAttenuation = 0.4f;
            light.PointLightConstantAttenuation = 0.7f;
            light.PointLightExponentialAttenuation = 0.008f;

            ViridionEntity.GetComponent<LightComponent> ().Light = light;

            state.Scene.AddLight (light);

            RigidBody ghostBody = new RigidBody (new SphereShape (1.2f));
            ghostBody.AffectedByGravity = false;
            ghostBody.AllowDeactivation = false;
            ghostBody.Mass = 20;
            ViridionEntity.GetComponent<PhysicsComponent> ().RigidBody = ghostBody;
            ViridionEntity.GetComponent<PhysicsComponent> ().World = state.PhysicsManager.World;
            ViridionEntity.GetComponent<PhysicsComponent> ().PhysicsApplying = AffectedByPhysics.Position;

            state.PhysicsManager.World.AddBody (ghostBody);

            ViridionEntity.GetComponent<ArtificialIntelligenceComponent>().AIManager = aiManager;
            ViridionEntity.GetComponent<ArtificialIntelligenceComponent>().ArtificialIntelligence =
                new ViridionAI (ViridionEntity, state, colorCorrectionNode);
            aiManager.RegisterEntity (ViridionEntity);
        }
Ejemplo n.º 6
0
        public SettingsMenu (Application app, Base parent, CompositorColorCorrectionNode colorCorrectionNode)
        {
            this.application = app;
            this.parent = parent;
            this.colorCorrectionNode = colorCorrectionNode;
            window = new WindowControl (parent);
            window.DisableResizing();
            window.Title = Localizer.Instance.GetValueForName("settings");
            window.Hide();

            float gamma = (float) ConfigManager.Instance["freezing_archer"].GetDouble("general", "gamma");
            colorCorrectionNode.Gamma = gamma;
            string language = ConfigManager.Instance["freezing_archer"].GetString("general", "language");
            Localizer.Instance.CurrentLocale = (LocaleEnum) Enum.Parse(typeof (LocaleEnum), language);

            languageLabel = new Label (window);
            languageLabel.AutoSizeToContents = true;
            languageLabel.Y = 10;
            languageLabel.Text = Localizer.Instance.GetValueForName("language");

            languageDropdown = new ComboBox (window);
            languageDropdown.Width = CONTROL_WIDTH;
            languageDropdown.Y = 10;
            foreach (var lang in Localizer.Instance.Locales)
            {
                var item = languageDropdown.AddItem(Localizer.Instance.GetValueForName(lang.Key.ToString()), lang.Key.ToString());
                item.AutoSizeToContents = false;
                item.Width = CONTROL_WIDTH;
            }
            languageDropdown.SelectByText(Localizer.Instance.GetValueForName(Localizer.Instance.CurrentLocale.ToString()));
            languageDropdown.ItemSelected += handleSelect;

            gammaSlider = new HorizontalSlider (window);
            gammaSlider.SnapToNotches = false;
            gammaSlider.Min = 0;
            gammaSlider.Max = 3;
            gammaSlider.Value = gamma;
            gammaSlider.ValueChanged += (sender, arguments) => {
                var slider = sender as HorizontalSlider;
                ConfigManager.Instance["freezing_archer"].SetDouble("general", "gamma", slider.Value);
                if (slider != null)
                    this.colorCorrectionNode.Gamma = slider.Value;
            };
            gammaSlider.Width = CONTROL_WIDTH;
            gammaSlider.Height = 20;
            gammaSlider.Y = 10 + languageDropdown.Y + languageDropdown.Height;

            gammaLabel = new Label (window);
            gammaLabel.AutoSizeToContents = true;
            gammaLabel.Y = 10 + languageLabel.Y + languageLabel.Height;
            gammaLabel.Text = Localizer.Instance.GetValueForName("gamma");

            int max_width = languageLabel.Width > gammaLabel.Width ? languageLabel.Width : gammaLabel.Width;

            languageLabel.X = 10 + max_width - languageLabel.Width;
            gammaLabel.X = 10 + max_width - gammaLabel.Width;
            languageDropdown.X = 10 + max_width + 5;
            gammaSlider.X = 10 + max_width + 5;

            window.Width = 40 + max_width + CONTROL_WIDTH;

            resetButton = new Button (window);
            resetButton.Text = Localizer.Instance.GetValueForName("reset");
            resetButton.Width = (window.Width / 2) - 20;
            resetButton.X = 10;
            resetButton.Y = gammaSlider.Y + gammaSlider.Height + 10;
            resetButton.Clicked += (sender, arguments) => {
                var general = ConfigManager.DefaultConfig.B.FirstOrDefault (a => a.Key == "general");
                var gamma_pair = general.Value.FirstOrDefault(a => a.Key == "gamma");
                
                float _gamma = (float) gamma_pair.Value.Double;
                gammaSlider.Value = _gamma;
                colorCorrectionNode.Gamma = _gamma;

                var language_pair = general.Value.FirstOrDefault(a => a.Key == "language");

                string lang = language_pair.Value.String;
                Localizer.Instance.CurrentLocale = (LocaleEnum) Enum.Parse(typeof (LocaleEnum), lang);
            };

            saveButton = new Button (window);
            saveButton.Text = Localizer.Instance.GetValueForName("save");
            saveButton.Width = (window.Width / 2) - 20;
            saveButton.X = resetButton.X + resetButton.Width + 10;
            saveButton.Y = gammaSlider.Y + gammaSlider.Height + 10;
            saveButton.Clicked += (sender, arguments) => ConfigManager.Instance.SaveAll();

            window.Height += languageDropdown.Height + gammaSlider.Height + 50;
            window.X = (parent.Width - window.Width) / 2;
            window.Y = (parent.Height - window.Height) / 2;

            ValidMessages = new[] { (int) MessageId.UpdateLocale };
            application.MessageManager += this;
        }
Ejemplo n.º 7
0
        public MainMenu (Application application, Action onPlayGame, CompositorColorCorrectionNode colorCorrectionNode)
        {
            this.application = application;
            this.onPlayGame = onPlayGame;

            ValidMessages = new[] { (int) MessageId.WindowResize, (int) MessageId.UpdateLocale };
            application.MessageManager += this;

            canvas = application.RendererContext.Canvas;
            var input = new FreezingArcherInput(application, application.MessageManager);
            input.Initialize (canvas);

            canvas.SetSize(application.Window.Size.X, application.Window.Size.Y);
            canvas.ShouldDrawBackground = false;

            settings = new SettingsMenu (application, canvas, colorCorrectionNode);
            tutorial = new TutorialMenu (application, canvas);

            background = new ImagePanel (canvas);
            background.ImageName = "Content/MainMenu.jpg";
            updateBackground();

            exitButton = new Button (canvas);
            exitButton.Text = Localizer.Instance.GetValueForName("quit_game");
            exitButton.Width = BUTTON_WIDTH;
            exitButton.X = 40;
            exitButton.Y = canvas.Height - exitButton.Height - 60;
            exitButton.Clicked += (sender, arguments) => application.Window.Close ();

            settingsButton = new Button (canvas);
            settingsButton.Text = Localizer.Instance.GetValueForName("settings");
            settingsButton.Width = BUTTON_WIDTH;
            settingsButton.X = 40;
            settingsButton.Y = exitButton.Y - settingsButton.Height - 40;
            settingsButton.Clicked += (sender, arguments) => settings.Show();

            tutorialButton = new Button (canvas);
            tutorialButton.Text = Localizer.Instance.GetValueForName("tutorial");
            tutorialButton.Width = BUTTON_WIDTH;
            tutorialButton.X = 40;
            tutorialButton.Y = settingsButton.Y - tutorialButton.Height - 40;
            tutorialButton.Clicked += (sender, arguments) => tutorial.Show();

            startButton = new Button (canvas);
            startButton.Text = Localizer.Instance.GetValueForName("start_game");
            startButton.Width = BUTTON_WIDTH;
            startButton.X = 40;
            startButton.Y = tutorialButton.Y - startButton.Height - 40;
            startButton.Clicked += (sender, arguments) => {
                application.MessageManager.UnregisterMessageConsumer(this);
                application.MessageManager.UnregisterMessageConsumer(settings);
                settings.Destroy();
                canvas.Dispose();
                onPlayGame();
            };

            acagamicsFoo = new ImagePanel (canvas);
            acagamicsFoo.ImageName = "Content/figure_color.png";
            acagamicsFoo.Width = 64;
            acagamicsFoo.Height = 106;
            acagamicsFoo.X = canvas.Width - acagamicsFoo.Width - 10;
            acagamicsFoo.Y = canvas.Height - acagamicsFoo.Height - 10;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FreezingArcher.Game.MazeTest"/> class.
        /// </summary>
        /// <param name="messageProvider">The message provider for this instance.</param>
        /// <param name="objmnr">The object manager for this instance.</param>
        /// <param name="rendererContext">The renderer context for the maze scenes.</param>
        /// <param name="game">The game the maze should be generated in.</param>
        public MazeTest (MessageProvider messageProvider, ObjectManager objmnr, RendererContext rendererContext,
            Content.Game game, Application app, CompositorNodeScene sceneNode,
            CompositorImageOverlayNode healthOverlayNode, CompositorColorCorrectionNode colorCorrectionNode,
            CompositorNodeOutput outputNode, CompositorWarpingNode warpingNode)
        {
            ValidMessages = new[] {
                (int) MessageId.Input,
                (int) MessageId.Update,
                (int) MessageId.HealthChanged,
                (int) MessageId.CollisionDetected,
                (int) MessageId.StaminaChanged,
                (int) MessageId.ItemUse,
                (int) MessageId.FlashlightToggled
            };
            messageProvider += this;
            mazeGenerator = new MazeGenerator (objmnr);

            MazeSceneNode = sceneNode;
            HealthOverlayNode = healthOverlayNode;
            ColorCorrectionNode = colorCorrectionNode;
            OutputNode = outputNode;
            WarpingNode = warpingNode;
            this.game = game;
            application = app;

            FPS_Text = new Gwen.ControlInternal.Text (app.RendererContext.Canvas);
            FPS_Text.String = "0 FPS";
            FPS_Text.Font = new Gwen.Font (app.RendererContext.GwenRenderer);
            FPS_Text.SetPosition (5, 5);
            FPS_Text.Font.Size = 15;
            FPS_Text.Hide ();

            HealthOverlayNode.OverlayTexture = rendererContext.CreateTexture2D ("bloodsplatter", true, "Content/bloodsplatter.png");
            HealthOverlayNode.Factor = 0;
            HealthOverlayNode.Blending = OverlayBlendMode.Multiply;
            warpingNode.WarpTexture = rendererContext.CreateTexture2D ("warp", true, "Content/warp.jpg");

            game.SceneNode = MazeSceneNode;

            game.AddGameState ("maze_overworld", Content.Environment.Default, null);
            var state = game.GetGameState ("maze_overworld");

            state.Scene = new CoreScene (rendererContext, messageProvider);
            state.Scene.SceneName = "MazeOverworld";
            state.Scene.Active = false;
            state.Scene.BackgroundColor = Color4.Fuchsia;
            state.Scene.DistanceFogIntensity = 0.07f;
            state.Scene.AmbientColor = Color4.White;
            state.Scene.AmbientIntensity = 0.3f;
            state.Scene.MaxRenderingDistance = 1000.0f;

            state.AudioContext = new AudioContext (state.MessageProxy);

            state.MessageProxy.StartProcessing ();

            loadingScreen = new LoadingScreen (application, messageProvider, "Content/loading.png",
                "MazeLoadingScreen",
                new[] { new Tuple<string, GameStateTransition> ("main_menu", GameStateTransition.DefaultTransition) },
                new[] { new Tuple<string, GameStateTransition> (state.Name, new GameStateTransition (0)) });

            endScreen = new EndScreen (application, rendererContext, new Tuple<string, GameStateTransition>[] {
                new Tuple<string, GameStateTransition> ("maze_overworld", GameStateTransition.DefaultTransition),
                new Tuple<string, GameStateTransition> ("maze_underworld", GameStateTransition.DefaultTransition)
            });

            game.SwitchToGameState ("MazeLoadingScreen");

            Player = EntityFactory.Instance.CreateWith ("player", state.MessageProxy, new[] {
                typeof(HealthComponent),
                typeof(StaminaComponent)
            }, new[] {
                typeof(MovementSystem),
                typeof(KeyboardControllerSystem),
                typeof(MouseControllerSystem),
                typeof(SkyboxSystem),
                typeof(PhysicsSystem)
            });

            inventoryGui = new InventoryGUI (app, state, Player, messageProvider, warpingNode);
            var inventory = new Inventory (messageProvider, state, Player, new Vector2i (5, 7), 9);
            inventoryGui.Init (rendererContext.Canvas, inventory);

            PauseMenu = new PauseMenu (application, ColorCorrectionNode, rendererContext.Canvas,
                () => maze [currentMaze].AIManager.StartThinking (), () => maze [currentMaze].AIManager.StopThinking ());
            
            AddAudio (state);

            // embed new maze into game state logic and create a MoveEntityToScene
            SkyboxSystem.CreateSkybox (state.Scene, Player);
            Player.GetComponent<TransformComponent> ().Position = new Vector3 (0, 1.85f, 0);
            var maze_cam_entity = EntityFactory.Instance.CreateWith ("maze_cam_transform", state.MessageProxy, new[] { typeof(TransformComponent) });
            var maze_cam_transform = maze_cam_entity.GetComponent<TransformComponent> ();
            var maze_cam = new BaseCamera (maze_cam_entity, state.MessageProxy, orthographic: true);
            state.Scene.CameraManager.AddCamera (maze_cam, "maze");
            maze_cam_transform.Position = new Vector3 (115, 240, 110);
            maze_cam_transform.Rotation = Quaternion.FromAxisAngle (Vector3.UnitX, MathHelper.PiOver2);
            state.Scene.CameraManager.AddCamera (new BaseCamera (Player, state.MessageProxy), "player");

            RigidBody playerBody = new RigidBody (new SphereShape (1f));
            playerBody.Position = Player.GetComponent<TransformComponent> ().Position.ToJitterVector ();
            playerBody.AllowDeactivation = false;
            playerBody.Material.StaticFriction = 0f;
            playerBody.Material.KineticFriction = 0f;
            playerBody.Material.Restitution = 0.1f;
            //playerBody.Mass = 1000000.0f;
            playerBody.Update ();
            Player.GetComponent<PhysicsComponent> ().RigidBody = playerBody;
            Player.GetComponent<PhysicsComponent> ().World = state.PhysicsManager.World;
            Player.GetComponent<PhysicsComponent> ().PhysicsApplying = AffectedByPhysics.Position;

            #if PRESENTATION
            Player.GetComponent<HealthComponent>().MaximumHealth = 500;
            Player.GetComponent<HealthComponent>().Health = 500;
            #endif

            state.PhysicsManager.World.AddBody (playerBody);

            int seed = new FastRandom ().Next ();
            var rand = new FastRandom (seed);
            Logger.Log.AddLogEntry (LogLevel.Debug, "MazeTest", "Seed: {0}", seed);

            #if PRESENTATION
            maze [0] = mazeGenerator.CreateMaze<OverworldMazeTheme> (rand.Next (), state.MessageProxy, state.PhysicsManager, app.AudioManager, 10, 10);
            #else
            maze [0] = mazeGenerator.CreateMaze<OverworldMazeTheme> (rand.Next (), state.MessageProxy, state.PhysicsManager, app.AudioManager, 30, 30);
            #endif
            maze [0].PlayerPosition += Player.GetComponent<TransformComponent> ().Position;
            maze [0].AIManager.RegisterEntity (Player);

            for (int i = 0; i < OverworldScobisCount; i++)
            {
                ScobisInstances.Add (new Scobis (state, maze [0].AIManager, rendererContext));
            }

            for (int i = 0; i < OverworldCaligoCount; i++)
            {
                CaligoInstances.Add (new Caligo (state, maze [0].AIManager, rendererContext, warpingNode));
            }

            for (int i = 0; i < OverworldViridionCount; i++)
            {
                ViridionInstances.Add (new Viridion (state, maze [0].AIManager, rendererContext, ColorCorrectionNode)); 
            }

            for (int i = 0; i < OverworldGhostCount; i++)
            {
                GhostInstances.Add (new Ghost (state, maze [0].AIManager, rendererContext, ColorCorrectionNode));
            }

            game.AddGameState ("maze_underworld", Content.Environment.Default,
                new[] { new Tuple<string, GameStateTransition> ("maze_overworld", new GameStateTransition (0)) },
                new[] { new Tuple<string, GameStateTransition> ("maze_overworld", new GameStateTransition (0)),
                    new Tuple<string, GameStateTransition> ("endscreen_state", new GameStateTransition (0))
                });
            state = game.GetGameState ("maze_underworld");
            state.Scene = new CoreScene (rendererContext, messageProvider);
            state.Scene.SceneName = "MazeUnderworld";
            state.Scene.Active = false;
            state.Scene.BackgroundColor = Color4.AliceBlue;
            state.Scene.DistanceFogIntensity = 0.07f;
            state.Scene.AmbientColor = Color4.White;
            state.Scene.AmbientIntensity = 0.3f;
            state.Scene.MaxRenderingDistance = 1000.0f;

            state.AudioContext = new AudioContext (state.MessageProxy);

            AddAudio (state);

            state.Scene.CameraManager.AddCamera (new BaseCamera (Player, state.MessageProxy), "player");
            #if PRESENTATION
            maze [1] = mazeGenerator.CreateMaze<UnderworldMazeTheme> (rand.Next (), state.MessageProxy, state.PhysicsManager, app.AudioManager, 10, 10);
            #else
            maze [1] = mazeGenerator.CreateMaze<UnderworldMazeTheme> (rand.Next (), state.MessageProxy, state.PhysicsManager, app.AudioManager, 30, 30);
            #endif
            maze [1].PlayerPosition += Player.GetComponent<TransformComponent> ().Position;
            maze [1].AIManager.RegisterEntity (Player);

            Func<int, int, bool> containsPortalFunc = (x, y) =>
            {
                foreach (var m in maze)
                {
                    var cell = m.entities [x, y].GetComponent<PhysicsComponent> ().RigidBody.Tag as MazeCell;
                    if (cell != null && cell.IsPortal)
                    {
                        return true;
                    }
                }
                return false;
            };

            mazeWallMover = new MazeWallMover (maze [0], maze [1], game.GetGameState ("maze_overworld"), containsPortalFunc);

            state.MessageProxy.StopProcessing ();
            //game.SwitchToGameState("maze_overworld");

            for (int i = 0; i < UnderworldCaligoCount; i++)
            {
                CaligoInstances.Add (new Caligo (state, maze [1].AIManager, rendererContext, warpingNode));
            }

            for (int i = 0; i < UnderworldPassusCount; i++)
            {
                PassusInstances.Add (new Passus (ColorCorrectionNode, state, maze [1].AIManager, rendererContext));
            }

            for (int i = 0; i < UnderworldRoachesCount; i++)
            {
                RoachesInstances.Add(new Roaches (state, maze [0].AIManager, rendererContext));
            }

            for (int i = 0; i < UnderworldFenFireCount; i++)
            {
                FenFireInstances.Add (new FenFire (state, maze [1].AIManager, rendererContext));
            }
        }