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


C# Game.Move方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            Game game = new Game();
              game.New();
              game.Moving += Game_Moving;

              while (true)
              {

            string res = Console.ReadLine();
            string[] resArray = res.Split(' ');
            switch (resArray[0])
            {
              case "e":
            return;
              case "n":
            game.New();
            break;
              case "r":
            Game_Moving(null, new MovingEventArgs(game.GetSquare()));
            break;
              case "g":
            switch (resArray[2])
            {
              case "u":
                game.Move(Convert.ToByte(resArray[1]), Direction.Up);
                break;
              case "d":
                game.Move(Convert.ToByte(resArray[1]), Direction.Down);
                break;
              case "l":
                game.Move(Convert.ToByte(resArray[1]), Direction.Left);
                break;
              case "r":
                game.Move(Convert.ToByte(resArray[1]), Direction.Right);
                break;
            }
            break;
            //что-то
            }
              }
        }
开发者ID:yuragagarin,项目名称:BarleyBreak,代码行数:42,代码来源:Program.cs

示例2: ThrowWhenGameCompleted

        public void ThrowWhenGameCompleted()
        {
            var game = new Game();
            var players = PlayerMother.GeneratePlayers(2);

            foreach (var player in players)
                game.Join(player);

            game.Start();

            foreach (var player in players)
                game.Move(player, Moves.Paper);

            Assert.Throws<InvalidGameStateException>(() => game.Join(PlayerMother.GeneratePlayer()));
        }
开发者ID:jasondentler,项目名称:RockPaperScissors,代码行数:15,代码来源:GameJoinShould.cs

示例3: Act

 public override void Act(Game game)
 {
     game.CurrentPlayer.HasWon = true;
     game.IsFinished = true;
     game.Move(0);
 }
开发者ID:Flavius1924,项目名称:Piticot,代码行数:6,代码来源:FairyCell.cs

示例4: Act

 public override void Act(Game game)
 {
     game.Move(-4);
 }
开发者ID:Flavius1924,项目名称:Piticot,代码行数:4,代码来源:WolfCell.cs

示例5: ThrowWhenGameNotStarted

        public void ThrowWhenGameNotStarted()
        {
            var game = new Game();
            var players = PlayerMother.GeneratePlayers(2).ToArray();

            foreach (var player in players)
                game.Join(player);

            Assert.Throws<InvalidGameStateException>(() => game.Move(players.First(), Moves.Paper));
        }
开发者ID:jasondentler,项目名称:RockPaperScissors,代码行数:10,代码来源:GameMoveShould.cs


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