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


C# Game.AddSession方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            Game game = new Game("Otter Pong", 700, 700);

            Global.PlayerOne = game.AddSession("P1");
            Global.PlayerTwo = game.AddSession("P2");

            Global.PlayerOne.Controller.Up.AddKey(Key.W);
            Global.PlayerOne.Controller.Down.AddKey(Key.S);

            Global.PlayerTwo.Controller.Up.AddKey(Key.Up);
            Global.PlayerTwo.Controller.Down.AddKey(Key.Down);

            game.FirstScene = new PongScene();

            game.Start();
        }
开发者ID:usdaproved,项目名称:OtterPongGame,代码行数:17,代码来源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            Game game = new Game("Frenemies", 800, 600, 60, false);
            game.SetWindow(800, 600);
            game.Title = "Frenemies";

            game.FirstScene = new TitleScene();

            //Debugging
            game.Debugger.ToggleKey = Key.Tilde;

            Global.PlayerOneSession = game.AddSession("P1");
            Global.PlayerTwoSession = game.AddSession("P2");
            Global.PlayerThreeSession = game.AddSession("P3");
            Global.PlayerFourSession = game.AddSession("P4");

            game.Start();
        }
开发者ID:patHyatt,项目名称:Frenemey,代码行数:18,代码来源:MainLoop.cs

示例3: Main

        static void Main(string[] args)
        {
            Game game = new Game("My game", 1000, 800);

            var scene = new GameScene(game.AddSession("Player"));
            scene.Player.Controller.Up.AddKey(Key.Up);
            scene.Player.Controller.Down.AddKey(Key.Down);
            scene.Player.Controller.Left.AddKey(Key.Left);
            scene.Player.Controller.Right.AddKey(Key.Right);
            game.FirstScene = scene;

            Console.Clear();
            game.Start();
        }
开发者ID:AlexSolari,项目名称:sRogue,代码行数:14,代码来源:Program.cs

示例4: Main

        static void Main(string[] args)
        {
            var game = new Game("Flippy Flop");
            game.Color = new Color("749ace");

            game.AddSession("Player");

            var c = game.Session("Player").Controller;

            game.GameFolder = "FlippyFlop";

            c.A.AddKey(Key.Z, Key.C, Key.X, Key.Space);

            game.FirstScene = new GameScene();

            game.Start();
        }
开发者ID:JOCP9733,项目名称:tank,代码行数:17,代码来源:Program.cs

示例5: Main

        static void Main(string[] args)
        {
            var game = new Game("Otter Space Invaders", 1920, 1080);
            Core.SpaceInvadersGame = game;

            Core.PlayerSesson = game.AddSession("Player");

            Core.PlayerSesson.Controller.Left.AddKey(Key.Left);
            Core.PlayerSesson.Controller.Right.AddKey(Key.Right);
            Core.PlayerSesson.Controller.A.AddKey(Key.Space);

            Debugger.Instance.RegisterCommand("showhitboxes", "Toggles the visibility of hitboxes.", GemDebug.CmdHitboxes, CommandType.Bool);

            Core.InvasionScene = new InvasionScene();
            game.FirstScene = new MenuScene();

            game.Start();
        }
开发者ID:holymoo,项目名称:OtterSpaceInvaders,代码行数:18,代码来源:Program.cs

示例6: Main

		static void Main( string[] args )
		{
			// Game window
			Game game;

			// Leap Motion Controller
			Leap.Listener LeapListener;
			Leap.Controller LeapController;

			// Game scene
			Scene_GameClass Scene_Game; // We want to initialize this after the game is initialized

			// Initialize
			{
				// Game Window
				game = new Game(
					"Tragic Magic", // Window Title
					1920, 1080, // Window size
					60, // Target FPS
					false // Fullscreen
				);
				game.SetWindowAutoFullscreen( true ); // VSync & auto max resolution

				// Leap Motion Controller
				LeapListener = new Leap.Listener();
				LeapController = new Leap.Controller();
				LeapController.AddListener( LeapListener );

				// Initialize player sessions
				game.AddSession( "LightWizard" );
				game.AddSession( "DarkWizard" );

				// Setup controls
				game.Session( "DarkWizard" ).Controller = new ControllerXbox360();
				game.Session( "LightWizard" ).Controller = new ControllerXbox360();

				// Keyboard / IPAC Controls
				// Movement
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Up.AddKey( Key.W );    // Up for Player 1
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Down.AddKey( Key.S );  // Down for Player 1
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Left.AddKey( Key.A );  // Left for Player 1
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Right.AddKey( Key.D ); // Right for Player 1

				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Start.AddKey( Key.Space ); //Ready Up button(?) / Start

				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Up.AddKey( Key.Up );    // Up for Player 2
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Down.AddKey( Key.Down );  // Down for Player 2
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Left.AddKey( Key.Left );  // Left for Player 2
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Right.AddKey( Key.Right ); // Right for Player 2

				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Start.AddKey( Key.Num0 ); //Ready Up button(?) //Start


				// Elements
				// Keyboard
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().RB.AddKey( Key.E ); // Cast Spell

				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().B.AddKey( Key.Num1 ); // Fire Element Key for Player 1
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().A.AddKey( Key.Num3 ); // Earth Element Key for Player 1
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Y.AddKey( Key.Num2 ); // Lightning Element Key for Player 1
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().X.AddKey( Key.Num4 ); // Water Element Key for Player 1

				game.Session( "LightWizard" ).GetController<ControllerXbox360>().RB.AddKey( Key.PageDown ); // Cast spell

				game.Session( "LightWizard" ).GetController<ControllerXbox360>().B.AddKey( Key.Num7 ); // Fire Element Key for Player 2
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().A.AddKey( Key.Num9 ); // Earth Element Key for Player 2
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Y.AddKey( Key.Num8 ); // Lightning Element Key for Player 2
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().X.AddKey( Key.Num0 ); // Water Element Key for Player 2



				// Xbox / Playstation Controller Controls

				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Up.AddAxisButton( AxisButton.PovYMinus, 0 );    // Up for Player 1 / DPAD UP
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Down.AddAxisButton( AxisButton.PovYPlus, 0 );  // Down for Player 1 / DPAD DOWN
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Left.AddAxisButton( AxisButton.PovXMinus, 0 );  // Left for Player 1 / DPAD LEFT
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Right.AddAxisButton( AxisButton.PovXPlus, 0 ); // Right for Player 1 / DPAD RIGHT

				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().B.AddButton( 1, 0 ); // Fire Element Key for Player 1 / RIGHT FACE BUTTON
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().A.AddButton( 0, 0 ); // Earth Element Key for Player 1 / DOWN FACE BUTTON
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Y.AddButton( 3, 0 );  // Lightning Element Key for Player 1 / UP FACE BUTTON
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().X.AddButton( 2, 0 ); // Water Element Key for Player 1 / RIGHT FACE BUTTON

				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().Start.AddButton( 7, 0 ); //Ready Up button(?)
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().LeftStick.AddAxis( JoyAxis.X, JoyAxis.Y, 0 ); //Left Stick Movement
				game.Session( "DarkWizard" ).GetController<ControllerXbox360>().RightStick.AddAxis( JoyAxis.U, JoyAxis.R, 0 ); //Right Stick Movement

				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Up.AddAxisButton( AxisButton.PovYMinus, 1 );     // Up for Player 2 / DPAD UP
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Down.AddAxisButton( AxisButton.PovYPlus, 1 ); // Down for Player 2 / DPAD DOWN
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Left.AddAxisButton( AxisButton.PovXMinus, 1 ); // Left for Player 2 / DPAD LEFT
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Right.AddAxisButton( AxisButton.PovXPlus, 1 ); // Right for Player 2 / DPAD RIGHT

				game.Session( "LightWizard" ).GetController<ControllerXbox360>().B.AddButton( 1, 1 ); // Fire Element Key for Player 2
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().A.AddButton( 0, 1 ); // Earth Element Key for Player 2
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Y.AddButton( 3, 1 );  // Lightning Element Key for Player 2
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().X.AddButton( 2, 1 ); // Water Element Key for Player 2

				game.Session( "LightWizard" ).GetController<ControllerXbox360>().Start.AddButton( 7, 1 ); //Ready Up button(?) 
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().LeftStick.AddAxis( JoyAxis.X, JoyAxis.Y, 1 ); //Left Stick Movement
				game.Session( "LightWizard" ).GetController<ControllerXbox360>().RightStick.AddAxis( JoyAxis.U, JoyAxis.R, 1 ); //Right Stick Movement
//.........这里部分代码省略.........
开发者ID:NeroInu,项目名称:TragicMagicOtter,代码行数:101,代码来源:Program.cs


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