当前位置: 首页>>代码示例>>C#>>正文


C# Content.SwitchToGameState方法代码示例

本文整理汇总了C#中Content.SwitchToGameState方法的典型用法代码示例。如果您正苦于以下问题:C# Content.SwitchToGameState方法的具体用法?C# Content.SwitchToGameState怎么用?C# Content.SwitchToGameState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Content的用法示例。


在下文中一共展示了Content.SwitchToGameState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MazeTest

        /// <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);
//.........这里部分代码省略.........
开发者ID:AreonDev,项目名称:NoWayOut,代码行数:101,代码来源:MazeTest.cs


注:本文中的Content.SwitchToGameState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。