• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IPlayer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IPlayer的典型用法代码示例。如果您正苦于以下问题:C# IPlayer类的具体用法?C# IPlayer怎么用?C# IPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IPlayer类属于命名空间,在下文中一共展示了IPlayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Execute

        public ISpecialEventResult Execute(IPlayer player)
        {
            var result = SpecialEventResult.Create();

            var firstDice = Dice.Throw();
            var secondDice = Dice.Throw();

            result.Dices.Add(firstDice);
            result.Dices.Add(secondDice);

            result.Success = IsMagicLessThanTwoDices(firstDice, secondDice, player);

            if (result.Success)
            {
                var position = player.Game.Board.GoFromInnerToMiddle();
                result.Player = player.SetPosition(position);
            }
            else
            {
                CommandHelper.RemoveOnePointOfLife(player);
            }

            result.Message =
                "Aby przeby� Trz�sawiska musisz u�y� Magii. Rzu� dwoma kostkami: wynik mniejszy lub r�wny twojej Magii - przeprawi�e� si� na drug� stron�." +
                " Wi�kszy wynik oznacza pora�k� (tracisz 1 �ycie). Nie mo�esz kontynuowa� podr�y dop�ki nie przejdziesz przez Trz�sawiska.";

            return result;
        }
开发者ID:spolnik,项目名称:Magiczny_Miecz_Game,代码行数:28,代码来源:UroczyskoCommand.cs


示例2: ChessEngine

 public ChessEngine( IBoard board, IPlayer white, IPlayer black, ConfigChess config )
 {
     this.board = board;
     this.white = white;
     this.black = black;
     this.config = config;
 }
开发者ID:jjrumi,项目名称:ChessGame,代码行数:7,代码来源:ChessEngine.cs


示例3: Execute

            public ISpecialEventResult Execute(IPlayer player)
            {
                var result = SpecialEventResult.Create();
                result.Success = true;

                var dice = Dice.Throw();
                result.Dices.Add(dice);

                switch (dice)
                {
                    case 1:
                    case 2:
                        CommandHelper.RemoveOnePointOfMight(player);
                        break;
                    case 3:
                    case 4:
                        CommandHelper.AddOnePointOfMight(player);
                        break;
                    case 5:
                        CommandHelper.AddOnePointOfMagic(player);
                        break;
                }

                result.Message =
                    "Rzuæ kostk¹ 1,2 - tracisz 1 punkt Miecza; 3,4 - zyskujesz 1 punkt Miecza; 5 - zyskujesz 1 punkt Magii; 6 - zosta³eœ zignorowany.";

                return result;
            }
开发者ID:spolnik,项目名称:Magiczny_Miecz_Game,代码行数:28,代码来源:OsadaCommand.cs


示例4: GetDesirablity

        public double GetDesirablity(IPlayer attacker, IHexa hexa)
        {
            if (map.GetPlayerOthers().Count == 0)
                return 0.0f;

            if (hexa.GetCapturedIPlayer() == attacker)
                return 0.0f;

            int enemySum = 0;
            int attackerSum = hexa.GetNormalProductivity(attacker);

            foreach (IPlayer player in map.GetPlayerOthers())
            {
                if (player == attacker)
                {
                    enemySum += hexa.GetNormalProductivity(map.GetPlayerMe());
                }
                else
                    enemySum += hexa.GetNormalProductivity(player);
            }

            if (hexa.GetCaptured() && hexa.GetCapturedIPlayer() != attacker)
            {
                return (enemySum + attackerSum) / 144.0f;
            }

            return (enemySum) / 144.0f;
        }
开发者ID:alenkacz,项目名称:Expanze,代码行数:28,代码来源:FortCaptureHexa.cs


示例5: PlacePlayerInScoreBoard

        /// <summary>
        /// Puts current player in score board. Determines position comparing player's scores with other entries in score board.
        /// </summary>
        /// <param name="player">Current players that plays the game.</param>
        public void PlacePlayerInScoreBoard(IPlayer player)
        {
            this.LoadTopPlayers(Globals.BestScoresPath);
            int emptyPosition = this.GetFirstFreePosition();

            if (this.scoreBoardTable.TopPlayers[emptyPosition] == null || player.Score >= this.scoreBoardTable.TopPlayers[emptyPosition].Score)
            {
                this.scoreBoardTable.TopPlayers[emptyPosition] = player;
                        
                for (int i = 0; i < emptyPosition; i++)
                {
                    IPlayer firstPlayer = this.scoreBoardTable.TopPlayers[i];
                    IPlayer secondPlayer = this.scoreBoardTable.TopPlayers[i + 1];

                    if (firstPlayer.Score < secondPlayer.Score)
                    {
                        this.scoreBoardTable.TopPlayers[i] = secondPlayer;
                        this.scoreBoardTable.TopPlayers[i + 1] = firstPlayer;
                    }
                }
            }

            this.export = new FileExporter(this.scoreBoardTable);
            this.export.Save(Globals.BestScoresPath);
        }
开发者ID:nlpcsh,项目名称:TA.HQC.Hangman-2,代码行数:29,代码来源:ScoreBoard.cs


示例6: Execute

        public ISpecialEventResult Execute(IPlayer player)
        {
            var result = SpecialEventResult.Create();
            var dice = Dice.Throw();
            result.Success = true;
            result.Dices.Add(dice);

            switch (dice)
            {
                case 1:
                    var straznik = StandardCreature.New("Stra¿nik Krêgu", 5);

                    var fightResult = straznik.Fight(player);
                    result.Success = fightResult.Success;

                    result.Dices.Add(fightResult.PlayerDice);
                    result.Dices.Add(fightResult.CreatureDice);

                    break;
                case 2:
                case 3:
                    CommandHelper.WaitOneTurn(player);
                    break;
                case 6:
                    CommandHelper.AddOnePointOfMagic(player);
                    break;
            }

            result.Message =
                "Musisz rzuciæ kostk¹: 1 - zosta³eœ zaatakowany przez Stra¿nika Krêgu (Miecz 5);" +
                " 2, 3 - tracisz 1 ture; 4, 5 - nic siê nie dzieje; 6 - zyskujesz 1 punkt Magii.";

            return result;
        }
开发者ID:spolnik,项目名称:Magiczny_Miecz_Game,代码行数:34,代码来源:KragMocyCommand.cs


示例7: MovePlayer

 private void MovePlayer(IPlayer player, int rollValue)
 {
     if (player.Location + rollValue > board.Locations.Count())
         player.Location = (player.Location + rollValue) % board.Locations.Count();
     else
         player.Location += rollValue;
 }
开发者ID:timallen527,项目名称:Monopoly,代码行数:7,代码来源:TurnManager.cs


示例8: RaiseAction

 public RaiseAction(IPlayer player, int raiseAmount, List<IPlayer> players, int playerIndex)
     : base(player, Actions.Raise)
 {
     this.RaiseAmount = raiseAmount;
     this.Players = players;
     this.PlayerIndex = playerIndex;
 }
开发者ID:TeamClementineSoftuni,项目名称:Poker,代码行数:7,代码来源:RaiseAction.cs


示例9: MastAdapter

 public MastAdapter(IPlayer player)
 {
     if (player == null) throw new NullReferenceException("Player cannot be null.");
     if (!(player is FrameworkElement)) throw new NullReferenceException("Player must be a FrameworkElement.");
     this.player = player;
     HookPlayerEvents();
 }
开发者ID:Ginichen,项目名称:Silverlight-Player-for-PlayReady-with-Token-Auth,代码行数:7,代码来源:MastAdapter.cs


示例10: Main

        static void Main(string[] args)
        {
            Console.Title = "TicTacToe";
            var players = new IPlayer[] { new HumanConsolePlayer(), new AlphaBetaMinimaxPlayer() };
            int current = 0;
            var alternante = 0;

            Grid g = Grid.Empty;
            while (true)
            {
                g = players[current].MakeMove(g);
                current = (current + 1) % 2;

                if (g.IsFinished)
                {
                    ConsoleGridRenderer.Render(g);
                    if (!g.IsDraw)
                        Console.WriteLine("{0} win!", g.CurrentIsO ? "X" : "O");
                    else
                        Console.WriteLine("Draw!");
                    current = (++alternante % 2);
                    g = Grid.Empty;
                }
                Console.WriteLine("\n");
            }
        }
开发者ID:ElemarJR,项目名称:TicTacToe,代码行数:26,代码来源:Program.cs


示例11: PlayerPositionPacket

 public PlayerPositionPacket(IPlayer player)
 {
     PlayerId = player.Id;
     X = player.Position.X;
     Y = player.Position.Y;
     Z = 0f;
 }
开发者ID:DynaStudios,项目名称:Slaysher,代码行数:7,代码来源:PlayerPositionPacket.cs


示例12: GetDescription

 private static string GetDescription(IPlayer player, uint numberOfCards)
 {
     if (numberOfCards == 1)
         return string.Format("{0} draws 1 card", player.Name);
     else
         return string.Format("{0} draws {1} cards", player.Name, numberOfCards);
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:DrawingCardsEffect.cs


示例13: GenerateGrid

        /// <summary>
        /// Generete game field
        /// </summary>
        /// <param name="grid">Field member</param>
        /// <param name="player"Player member></param>
        /// <returns>Genereted game filed</returns>
        public IGrid GenerateGrid(IPlayer player, IGrid grid)
        {
            DefaultRandomGenerator random = DefaultRandomGenerator.Instance();
            int percentageOfBlockedCells = random.Next(GlobalConstants.MinimumPercentageOfBlockedCells, GlobalConstants.MaximumPercentageOfBlockedCells);

            for (int row = 0; row < grid.TotalRows; row++)
            {
                for (int col = 0; col < grid.TotalCols; col++)
                {
                    int num = random.Next(0, 100);
                    if (num < percentageOfBlockedCells)
                    {
                        grid.SetCell(row, col, GlobalConstants.BlockedCellSymbol);
                    }
                    else
                    {
                        grid.SetCell(row, col, GlobalConstants.FreeCellSymbol);
                    }
                }
            }

            grid.SetCell(grid.TotalRows / 2, grid.TotalCols / 2, GlobalConstants.PlayerSignSymbol);

            this.MakeAtLeastOneExitReachable(grid, player);
            return grid;
        }
开发者ID:TeamLabyrinth5-Telerik,项目名称:Labyrinth,代码行数:32,代码来源:Initializer.cs


示例14: Game

 public Game(IPlayer player, DelegateCreateRaceLineup createRaceLineup, DelegateAggregateSnails aggregateSnails, IBookie bookie)
 {
     this.player           = player;
     this.createRaceLineup = createRaceLineup;
     this.aggregateSnails  = aggregateSnails;
     this.bookie           = bookie;
 }
开发者ID:squimmy,项目名称:SnailRace,代码行数:7,代码来源:Game.cs


示例15: Start

 // Use this for initialization
 void Start()
 {
     lightning = GetComponent<Lightning>();
     lightning.enabled = false;
     player = GetComponent<IPlayer>();
     lightning.maxLength = 200f;
 }
开发者ID:EECS390IndieTeam,项目名称:GameProject,代码行数:8,代码来源:GrappleBeamDrawer.cs


示例16: Update

        public override void Update(GameTime gameTime, IPlayer currentPlayer)
        {
            if (this.SpecialtyFired)
            {
                // TODO moje da se izvede v private method void Move() i Atack() primerno..
                // nqkak da se porazkachi Update() (ako ima vreme)
                if (currentPlayer is FirstPlayer)
                {
                    Collide = SpecialtyCollision.Collide(SecondPlayer.Instance.Ship, this);
                    if (Collide)
                    {
                        currentPlayer.Ship.SpecialtyAttack(SecondPlayer.Instance.Ship);
                    }

                    this.AddToPosition(Direction.Positive, CoordsDirections.Abscissa, HURRICANE_SPEED);
                }
                else
                {
                    Collide = SpecialtyCollision.Collide(FirstPlayer.Instance.Ship, this);
                    if (Collide)
                    {
                        currentPlayer.Ship.SpecialtyAttack(FirstPlayer.Instance.Ship);
                    }

                    this.AddToPosition(Direction.Negative, CoordsDirections.Abscissa, HURRICANE_SPEED);
                }
            }
        }
开发者ID:vangelov-i,项目名称:Badass-Pirates2.0,代码行数:28,代码来源:Hurricane.cs


示例17: DefaultPiece

        public DefaultPiece(IPlayer player)
        {
            if (player == null)
                throw new ArgumentNullException(nameof(player));

            this.Player = player.Name;
        }
开发者ID:MarinAtanasov,项目名称:Backgammon,代码行数:7,代码来源:DefaultPiece.cs


示例18: TwoPlayersTexasHoldemGame

        public TwoPlayersTexasHoldemGame(IPlayer firstPlayer, IPlayer secondPlayer, int initialMoney = 1000)
        {
            if (firstPlayer == null)
            {
                throw new ArgumentNullException(nameof(firstPlayer));
            }

            if (secondPlayer == null)
            {
                throw new ArgumentNullException(nameof(secondPlayer));
            }

            if (initialMoney <= 0 || initialMoney > 200000)
            {
                throw new ArgumentOutOfRangeException(nameof(initialMoney), "Initial money should be greater than 0 and less than 200000");
            }

            // Ensure the players have unique names
            if (firstPlayer.Name == secondPlayer.Name)
            {
                throw new ArgumentException($"Both players have the same name: \"{firstPlayer.Name}\"");
            }

            this.firstPlayer = new InternalPlayer(firstPlayer);
            this.secondPlayer = new InternalPlayer(secondPlayer);
            this.allPlayers = new List<InternalPlayer> { this.firstPlayer, this.secondPlayer };
            this.initialMoney = initialMoney;
            this.HandsPlayed = 0;
        }
开发者ID:GoranGit,项目名称:TexasHoldemGameEngine,代码行数:29,代码来源:TwoPlayersTexasHoldemGame.cs


示例19: Fold

 /// <summary>
 /// Indicates that the current player gives up on the current round. He cannot participate in the round any more and losses the raised or called chips.
 /// </summary>
 public void Fold(IPlayer currentPlayer, ref bool isRaisingActivated)
 {
     isRaisingActivated = false;
     currentPlayer.Status.Text = "Fold";
     currentPlayer.OutOfChips = true;
     currentPlayer.CanPlay = false;
 }
开发者ID:IvanYanchev,项目名称:HQC-Teamwork-Project-Poker,代码行数:10,代码来源:ActionManager.cs


示例20: Game

        /// <summary>
        /// Create a game
        /// You pass in two IPlayers
        /// At least one player must be a ComputerPlayer
        /// </summary>
        /// <param name="player1"></param>
        /// <param name="player2"></param>
        public Game(IPlayer player1, IPlayer player2)
        {
            if ((player1 == null) || (player2 == null))
            {
                throw new EUndefinedPlayer();
            }

            if ((player1 is HumanPlayer) && (player2 is HumanPlayer))
            {
                throw new ETwoHumanPlayers();
            }

            Player1 = player1;
            Player2 = player2;

            if ( string.IsNullOrEmpty(Player1.PlayerName))
            {
                Player1.PlayerName = "Player1";
            }

            if (string.IsNullOrEmpty(Player2.PlayerName))
            {
                Player1.PlayerName = "Player2";
            }
        }
开发者ID:ChrisBrooksbank,项目名称:RockPaperScissors,代码行数:32,代码来源:Game.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPlotArea类代码示例发布时间:2022-05-24
下一篇:
C# IPlaybackManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap