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


C# IPlayer类代码示例

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


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


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