public void RespawnPlayer(PlayerType playerType){ if (this){ if (isActiveAndEnabled){ StartCoroutine(RespawnMeInLevel(playerType)); } } }
public Player(int playerNumber, PlayerType type) { this.playerNumber = playerNumber; this.currentPosition = null; this.possibleMoves = Move.getPossibleMoves(Core.drawCube.cube, currentPosition); this.type = type; if (type == PlayerType.AI) { switch (playerNumber) { case 1: setAIFunc(Config.getValue("ai", "player_one")); break; case 2: setAIFunc(Config.getValue("ai", "player_two")); break; } } }
public Player(String id, List<Card> cards, Card currentCard, PlayerType playerType) { this.id = id; this.cards = cards; this.currentCard = currentCard; this.playerType = playerType; }
// CONSTRUCTORS public Player(PlayerType type, int spriteWidht, int spriteHeight) { if (type == PlayerType.Hero) { this.Hitbox = new Rectangle(120, 120, spriteWidht, spriteHeight); this.FrameLine = 1; this.FrameColumn = 3; this.Effects = SpriteEffects.None; this.Direction = Direction.Down; this.Animation = true; this.Timer = 0; } if (type == PlayerType.Ennemy) { this.IAHitbox = new Rectangle(120, 120, spriteWidht, spriteHeight); this.FrameLine = 1; this.FrameColumn = 3; this.Effects = SpriteEffects.None; this.Direction = Direction.Down; this.Animation = true; this.Timer = 0; } if (type == PlayerType.Munition) { this.MuniHitbox = new Rectangle(120, 120, spriteWidht, spriteHeight); this.FrameLine = 1; this.FrameColumn = 3; this.Effects = SpriteEffects.None; this.Direction = Direction.Down; this.Animation = true; this.Timer = 0; } }
public Engine(PlayerType playerType, IUserInterface inputInterface) { this.PlayerType = playerType; this.rnd = new Random(); this.inputInterface = inputInterface; this.AllObjects = new List<WorldObject>(); }
public static GameObject GetPrefabInstanceFromType( PlayerType type ) { string objectName; switch (type) { case PlayerType.PLAYER: objectName = "PlayerNormal"; break; case PlayerType.MONSTER: objectName = "Toothy"; break; case PlayerType.AI_MONSTER: objectName = "AIToothy"; break; case PlayerType.AI_PLAYER: objectName = "AIPlayerNormal"; break; default: objectName = "AIPlayerNormal"; break; } string localPath = "Prefabs/Characters/" + objectName; Object localInstance = Resources.Load<GameObject>( localPath ); GameObject instance = Instantiate( localInstance ) as GameObject; return instance; }
public static ReversiPlayer Create(PlayerType type, int color) { switch (type) { case PlayerType.MiniMax1: return new ReversiPlayer(color, new MinMaxStrategy(new ScoreAndCornersEvaluator(), 2, color)); case PlayerType.MiniMax2: return new ReversiPlayer(color, new MinMaxStrategy(new ScoreAndCornersEvaluator(), 4, color)); case PlayerType.MiniMax25: return new ReversiPlayer(color, new MinMaxStrategy(new ScoreAndCornersEvaluator(), 5, color)); case PlayerType.MiniMax3: return new ReversiPlayer(color, new MinMaxStrategy(new ScoreAndCornersEvaluator(), 6, color)); case PlayerType.Random: return new ReversiPlayer(color, new RandomStrategy()); case PlayerType.AlwaysFirst: return new ReversiPlayer(color, new AlwaysFirstStrategy()); case PlayerType.Minimax2WithoutCorners: return new ReversiPlayer(color, new MinMaxStrategy(new ScoreEvaluator(), 2, color)); case PlayerType.DynamicMinmax: return new ReversiPlayer(color, new DynamicMinMaxStrategy(color)); default: return null; } }
public virtual void ChangeRole(PlayerType newRole, bool respawn = false) { Debug.Log(this.gameObject.name + " Change type from: "+this.Type +" to: " + newRole); // Set new role this.Type = newRole; }
private void PlaceMark(PlayerType mark, int row, int col) { if (CurrentTurn != mark) { throw new OutOfTurnException(); } if (row < 0 || row > 2) { throw new ArgumentOutOfRangeException("row"); } if (col < 0 || col > 2) { throw new ArgumentOutOfRangeException("col"); } if (_squares[row, col] != PlayerType.None) { throw new InvalidOperationException("A mark has already been placed at that position."); } _squares[row, col] = mark; CheckIfLastMoveEndsGame(row, col); ChangeTurns(); }
private void OnPlayerDied(PlayerType param) { _advanceCountdown = advanceLevelDelayLevelDeath; _nextLevelName = _levelSequence[_currentLevel]; CameraFade.StartAlphaFade(Color.black, false, _advanceCountdown, 2f, () => { Application.LoadLevel(_nextLevelName); }); }
public Game(ref Player playerA,ref Player playerB,Difficulty difficulty,GameMode gameMode) { current_game = this; board = new PlayerType[3,3]{{PlayerType.NONE,PlayerType.NONE,PlayerType.NONE}, {PlayerType.NONE,PlayerType.NONE,PlayerType.NONE}, {PlayerType.NONE,PlayerType.NONE,PlayerType.NONE}}; this.playerA = playerA; this.playerA.score = 0; this.playerB = playerB; this.difficulty = difficulty; this.game_mode = gameMode; if (game_mode == GameMode.SINGLE_PLAYER) { //playerA.name = "User"; playerB.name = "Computer"; playerA.moveAllowed = true; playerB.moveAllowed = false; }else if(game_mode == GameMode.MULTI_PLAYER_STANDALONE){ //playerA.name = "Ball"; playerB.name = "Cross"; //playerA.moveAllowed = true; playerB.moveAllowed = false; this.difficulty = Difficulty.NONE; } else if (game_mode == GameMode.MULTI_PLAYER) { this.difficulty = Difficulty.NONE; } this.current_player = playerA; this.connected = false; }
public ThreadedLimakeGame(PlayerType Green, PlayerType Red, PlayerType Blue, PlayerType Yellow) { beersDrunk = new int[5]; IPlayer[] players = new IPlayer[] { GetPlayer(Green), GetPlayer(Red), GetPlayer(Blue), GetPlayer(Yellow) }; game = new Game(this, players); }
public PlayerFactory(PlayerType playerType, string url) { PreparedPlayerType = playerType; PreparedUrl = url; SelectPlayerType(); PreparePlayer(); }
public void SetControls(PlayerType playerType){ if (playerType == PlayerType.Explo){ horizontal = "P1_Horizontal"; vertical = "P1_Vertical"; action = "P1_Action"; jump = "P1_Jump"; pause = "P1_Pause"; toss = "P1_Toss"; door = "P1_Door"; toggleCamera = "P1_ToggleCamera"; restart = "P1_Restart"; isExplo = true; } else if (playerType == PlayerType.Implo){ horizontal = "P2_Horizontal"; vertical = "P2_Vertical"; action = "P2_Action"; jump = "P2_Jump"; pause = "P2_Pause"; toss = "P2_Toss"; door = "P2_Door"; toggleCamera = "P2_ToggleCamera"; restart = "P2_Restart"; isExplo = false; } }
public Empire(string emperorName, int empireID, Race race, PlayerType type, Color color, GameMain gameMain) : this() { Reserves = 0; TaxRate = 0; this.empireName = emperorName; this.empireID = empireID; this.type = type; EmpireColor = color; try { TechnologyManager.SetComputerTechs(gameMain.MasterTechnologyManager.GetRandomizedComputerTechs()); TechnologyManager.SetConstructionTechs(gameMain.MasterTechnologyManager.GetRandomizedConstructionTechs()); TechnologyManager.SetForceFieldTechs(gameMain.MasterTechnologyManager.GetRandomizedForceFieldTechs()); TechnologyManager.SetPlanetologyTechs(gameMain.MasterTechnologyManager.GetRandomizedPlanetologyTechs()); TechnologyManager.SetPropulsionTechs(gameMain.MasterTechnologyManager.GetRandomizedPropulsionTechs()); TechnologyManager.SetWeaponTechs(gameMain.MasterTechnologyManager.GetRandomizedWeaponTechs()); } catch (Exception e) { MessageBox.Show(e.Message); } EmpireRace = race; }
private String tileName; // The path to image file #endregion Fields #region Constructors public Door(Game game, Point pos, String tileName, PlayerType pt) : base(game, pos) { this.tileName = tileName; collisionManager.RegisterObject(this); playerType = pt; }
public void AddToGame(AbstractGame game, PlayerType playerType) { _game = game; _playerType = playerType; AbstractGame.StepHandler stepHandler = AlfaBetaStepHandler; game.RegisterAsPlayer(ref stepHandler, playerType); }
public Player(List<Player> players, OutputType outputType) { writer = new Output(outputType); writer.Write("Enter the name of the player: "); this.name = Console.ReadLine().Trim(); writer.Write("Enter the piece you want to use: "); this.piece = new Piece(Console.ReadLine().Trim()); while (players.Select(p => p).Where(x => string.Compare(x.Piece.Symbol, this.piece.Symbol) == 0).Count() >= 1) { writer.Write("That piece has already been taken.\nChoose a different piece: "); this.piece = new Piece(Console.ReadLine().Trim()); } writer.Write("Is this player HUMAN or AI: "); do { var playerType = Console.ReadLine().Trim(); PlayerType humanOrNot; if (Enum.TryParse<PlayerType>(playerType.ToUpper(), out humanOrNot)) { this.playerType = humanOrNot; break; } writer.Write("Enter a valid Player Type: [human] or [AI]: "); continue; } while (true); this.order = -1; }
public static Player getPlayer(PlayerType name) { switch (name) { case PlayerType.Boring: return new PlayerBoring (); break; case PlayerType.Logic: return new PlayerLogic (); break; case PlayerType.MinMax: return new PlayerMinMax (); break; case PlayerType.NeuralBlank: return new PlayerNeural (createNetwork ()); break; case PlayerType.NeuralLoad: return new PlayerNeural (loadNetwork ()); break; case PlayerType.Random: return new PlayerRandom (); break; case PlayerType.Human: return new PlayerHuman (); break; } return new PlayerBoring (); }
public void Impulse(PlayerType type) { if (type == PlayerType.Left) StartCoroutine(Impulsing(m_LeftImpulse)); if (type == PlayerType.Right) StartCoroutine(Impulsing(m_RightImpulse)); }
/// <summary> /// Plays a turn /// </summary> /// <param name="playerType">Player type</param> /// <param name="row">Row in which to play. Use 0-2</param> /// <param name="column">Column in which to play. Use 0-2</param> public void PlayTurn(PlayerType playerType, int row, int column) { ValidateTurn(playerType, row, column); Board[row, column] = playerType; previousPlayer = playerType; return; }
/// <summary> /// Server init without client /// </summary> /// <param name="type">0-Server; 1-Client</param> /// <param name="port"></param> public NetInterection(PlayerType type, string port) { if (type == PlayerType.ptClient) throw new Exception(); // server = new TcpListener(System.Net.Dns.GetHostEntry(Dns.GetHostName()).AddressList[1], int.Parse(port)); server = new TcpListener(int.Parse(port)); server.Start(); }
public PlayerData(int id, int carType, ControlScheme ctrlScheme, PlayerType playerType) { _carType = carType; _ctrlScheme = ctrlScheme; _playerType = playerType; _lives = 10; ID = id; }
public ChooseStreamingEndpoint(CloudMediaContext context, IAsset asset, string filter = null, PlayerType playertype =PlayerType.AzureMediaPlayer) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _context = context; _asset = asset; _filter = filter; _playertype = playertype; }
public bool IsMoveValid(int fromRow, int fromColumn, int toRow, int toColumn, PieceType fromPieceType, PieceType toPieceType, PlayerType playerInTurn) { if (IsJumping(fromRow, fromColumn, toRow, toColumn)) return false; if (!IsOriginValid(fromPieceType, playerInTurn)) return false; if (!IsMovingForward(fromRow, toRow, playerInTurn)) return false; return IsDestinationValid(fromColumn, toColumn, toPieceType, playerInTurn); }
public TcpPlayer (Socket s , int _id , PlayerType _type) : base(_id, _type) { socket = s; ThreadStart ts = new ThreadStart(ListenPlayer); tread = new Thread(ts); tread.Start(); SendWelcomeValues(); }
internal BasePlayer(PlayerType setPlayerType) { Name = "Player"; Race = Game.Race.Humans; PlayerType = setPlayerType; Entities = new List<Entity> (); Gold = 0; Lumber = 0; }
private void AddNewPlayerAsChildAndDisable(PlayerType type) { GameObject player = (GameObject) Instantiate(Resources.Load("Players" + "/" + type.ToString())); player.transform.parent = transform; player.transform.localPosition = Vector3.zero; player.SetActive(false); playerHT[type] = player; }
private void SpawnPiece(PlayerType p, PieceType t, Position pos, Transform parent) { GameObject go = Instantiate(piecePrefab) as GameObject; Piece piece = go.GetComponent<Piece>(); go.transform.parent = parent; piece.Set(p, t, pos); GameController.Instance.board.GetField(pos).Occupy(piece); }
/// <summary> /// Client init /// </summary> /// <param name="type">0-Server; 1-Client</param> /// <param name="ip"></param> /// <param name="port"></param> public NetInterection(PlayerType type, string ip, string port) { if (type == PlayerType.ptServer) throw new Exception(); client = new TcpClient(ip, int.Parse(port)); stream = client.GetStream(); connected = true; }
public bool ExistKingOnBoard(PlayerType player) { return(FindKingOnBoard(player) != null); }
/// <summary> /// Increase the score of the given Player. /// </summary> /// <param name="player">the player whose score to increase</param> private void Score(PlayerType player) => this.scores[player].Increment();
public void SetMode(PlayerType type) { m_Type = type; }
public Bishop(int _x, int _y, PlayerType pt, FigureType ft, Engine e) : base(_x, _y, pt, ft, e) { }
{ /// <summary> /// create CaoCao /// </summary> /// <param name="pos"> this is the position of the player in All player</param> public CaoCao(int pos, PlayerType type) : base(pos, Legends_of_the_Three_Kingdoms.Properties.Resources.Cao_Cao, Legends_of_the_Three_Kingdoms.Properties.Resources.When_Cao_Cao_is_damaged_by_a_c, 4, type) { }
private int Search(Game game, PlayerType player, int alpha, int beta, int depth, List <MoveCommand> bestMoveCommands, CancellationToken cancellation) { if (cancellation.IsCancellationRequested) { return(0); } if (game.State.IsEnd) { if (game.State.GameResult.Winner == player) { return(InfiniteEvaluationValue); } else { return(-InfiniteEvaluationValue); } } //if (game.IsWinning(player.Opponent)) // return -InfiniteEvaluationValue; //if (game.IsWinning(player)) // return InfiniteEvaluationValue; if (depth <= 0) // [深さが最大に達した] { return(Evaluation(game, player)); } var moveCommands = game.CreateAvailableMoveCommand(); if (debug) { if (depth == this.Depth) { System.Diagnostics.Debug.WriteLine("------------------------------------"); System.Diagnostics.Debug.WriteLine("深さ:" + depth.ToString()); System.Diagnostics.Debug.WriteLine("---------盤面------------"); System.Diagnostics.Debug.WriteLine(game.ToString()); System.Diagnostics.Debug.WriteLine("手番:" + game.State.TurnPlayer.ToString()); System.Diagnostics.Debug.WriteLine("---------着手可能手------------"); System.Diagnostics.Debug.WriteLine(string.Join('\n', moveCommands)); } } if (moveCommands.Count == 0) { System.Diagnostics.Debug.WriteLine("★着手可能手0"); return(-InfiniteEvaluationValue); } // [αβ法は良い手の順に探索を行うと最も効率が良い] moveCommands = SortByBetterMove(moveCommands, game); // [★勝ち確のときに遊ぶのを何とかしたい] // [全ての子ノードを展開し,再帰的に評価] for (int i = 0; i < moveCommands.Count; i++) { var gameTmp = game.Clone().PlayWithoutCheck(moveCommands[i]); // [現在,既に自分は最低でもα値の手が存在するため,相手が相手にとって-α値より良い手を見つけても] // [無意味となるため(自分はその手を指さないだけ),-α値が相手の探索の上限となる.] // [MEMO:枝刈りした場合、最善手と同じ評価値を返しているのでα値と同じ値が返っても、] // [最善手ではないので注意(相手側がより最善の手があるので)] int val = -Search(gameTmp, player.Opponent, -beta, -alpha, depth - 1, null, cancellation); // [MEMO:キャンセルした場合は、候補手一覧は空にするため、ここでリターンする] if (cancellation.IsCancellationRequested) { return(0); } // [最善手(MAX)を求める] if (alpha < val) { alpha = val; // [α値の更新] if (bestMoveCommands != null) { bestMoveCommands.Clear(); bestMoveCommands.Add(moveCommands[i]); } } if (debug) { if (depth == this.Depth) { System.Diagnostics.Debug.WriteLine("評価値:" + moveCommands[i].ToString() + " -> " + val.ToString()); } } //System.Diagnostics.Debug.WriteLine((new string(' ', Depth- depth)) + "評価値:" + moveCommands[i].ToString() + " -> " + val.ToString()) ; if (alpha >= beta) // [より良い手がないと枝切りを行う] { return(alpha); } } return(alpha); }
public Card getNextOfferedCard(PlayerType characterIn) { var card = RouletteSelection.pick(allCards.Where(c => characterIn == c.playerType && c.isStarting == false)); return((Card)(Activator.CreateInstance(card.GetType()))); }
private void setPrefs() { //set gameMode, whiteplayer, and blackplayer variables based on input from character select screen int player1character = PlayerPrefs.GetInt("Player1Character"); int player2character = PlayerPrefs.GetInt("Player2Character"); int gameIndex = SceneManager.GetActiveScene().buildIndex; if (gameIndex == 6) { gameMode = PlayerType.Local; //set the player2 character player2character = PlayerPrefs.GetInt("Player2Character"); } else if (gameIndex == 7) { gameMode = PlayerType.Network; //more in another function because need the game core by then } else if (gameIndex == 8) { gameMode = PlayerType.AI; //pick a random character for the AI int aiCharacter = Random.Range(0, 2); while (aiCharacter == player1character) { //so ai and player will not be same character aiCharacter = Random.Range(0, 2); } player2character = aiCharacter; if (PlayerPrefs.GetInt("difficulty", 0) == 1) { _isHardMode = true; } else { _isHardMode = false; } } int player1white = PlayerPrefs.GetInt("player1", 0); if (player1white == 0) { //player1 is white whitePlayer = PlayerType.Local; blackPlayer = gameMode; //blackCam.enabled = false; //Camera.main.enabled = true; SetNotations(true); whiteCharacter = player1character; blackCharacter = player2character; isPlayer1White = true; } else if (player1white != 0 && gameMode != PlayerType.Local) { //player1 is black blackPlayer = PlayerType.Local; whitePlayer = gameMode; blackCam.enabled = true; Camera.main.enabled = false; SetNotations(false); blackCharacter = player1character; whiteCharacter = player2character; isPlayer1White = false; } //set the player portraits setCharacterImage(1, player1character); setCharacterImage(2, player2character); gameMode = whitePlayer; //testfirst(); //set the tokens TokenSetter tokenScript = GetComponent <TokenSetter>(); tokenScript.SetTokens(player1white, player1character, player2character); //set the character for the emotes player1emote.SetCharacter(player1character, true); player2emote.SetCharacter(player2character, false); //set the log's characters log.SetCharacters(whiteCharacter, blackCharacter); }
public Koma FindHandKoma(PlayerType player, KomaType komaType) { return(KomaList.FirstOrDefault(x => x.Player == player && x.IsInHand && x.KomaType == komaType)); }
public BoardPositions BoardPositions(PlayerType player) { return(new BoardPositions(KomaList.Where(x => x.Player == player && x.IsOnBoard).Select(x => x.BoardPosition).ToList())); }
public bool IsTurnPlayer(PlayerType player) { return(TurnPlayer == player); }
public List <Koma> GetKomaListDistinct(PlayerType player) { return(GetKomaList(player).Distinct(new Koma.ValueComparer()).ToList()); }
public GameState(List <Koma> komaList, PlayerType turnPlayer) { KomaList = komaList; TurnPlayer = turnPlayer; GameResult = null; }
{/// <summary> /// create SunQuan /// </summary> /// <param name="pos ">is the position of the player in All player</param> public SunQuan(int pos, PlayerType type) : base(pos, Legends_of_the_Three_Kingdoms.Properties.Resources.Sun_Quan, Legends_of_the_Three_Kingdoms.Properties.Resources.Once_during_his_turn_Sun_Quan_, 4, type) { }
/// <summary> /// 打牌 /// </summary> /// <param name="seatIdx">出牌玩家座号</param> /// <param name="paiIdx">牌号</param> /// <param name="paiType">牌类型(已有手牌还是摸过来的牌)</param> /// <param name="mjFaceValue">牌面值</param> /// <param name="handActionNum">手部动作编号</param> public void DaPai(int seatIdx, PlayerType handStyle, int paiIdx, HandPaiType paiType, MahjongFaceValue mjFaceValue, bool isJiaoTing, ActionCombineNum handActionNum, LinkedListNode <MahjongMachineCmd> opCmdNode = null) { StopSelectPaiActionState(seatIdx); if (playerStateData[seatIdx].playerHandActionState != HandActionState.ACTION_END || mjSeatHandPaiLists[seatIdx].Count == 0 || mjSeatHandPaiLists[seatIdx][0] == null) { RemoveHandActionOpCmd(seatIdx, opCmdNode); return; } if (paiIdx >= 0 && ((paiIdx < mjSeatHandPaiLists[seatIdx].Count && paiType == HandPaiType.HandPai) || (paiIdx < mjSeatMoPaiLists[seatIdx].Count && paiType == HandPaiType.MoPai))) { if (paiType == HandPaiType.HandPai) { if (paiIdx >= mjSeatHandPaiLists[seatIdx].Count) { RemoveHandActionOpCmd(seatIdx, opCmdNode); return; } GameObject mj = mjSeatHandPaiLists[seatIdx][paiIdx]; if (mj == null) { RemoveHandActionOpCmd(seatIdx, opCmdNode); return; } mjSeatHandPaiLists[seatIdx].RemoveAt(paiIdx); if (seatIdx != 0) { mjAssetsMgr.PushMjToOtherHandMjPool(mj); } else { mjAssetsMgr.PushMjToDeskOrSelfHandMjPool(mj); } } else { if (paiIdx >= mjSeatMoPaiLists[seatIdx].Count) { RemoveHandActionOpCmd(seatIdx, opCmdNode); return; } GameObject mj = mjSeatMoPaiLists[seatIdx][paiIdx]; if (mj == null) { RemoveHandActionOpCmd(seatIdx, opCmdNode); return; } mjSeatMoPaiLists[seatIdx].RemoveAt(paiIdx); if (seatIdx != 0) { mjAssetsMgr.PushMjToOtherHandMjPool(mj); } else { mjAssetsMgr.PushMjToDeskOrSelfHandMjPool(mj); } } } NextDeskMjPos(seatIdx); Vector3Int mjposIdx = GetCurtDeskMjPosIdx(seatIdx); playerStateData[seatIdx].SetDaPaiData(handStyle, mjposIdx, mjFaceValue, isJiaoTing, handActionNum, opCmdNode); playerStateData[seatIdx].SetPlayerState(HandActionState.DA_PAI_START, Time.time, -1); }
{/// <summary> /// create ZhangFei /// </summary> /// <param name="pos ">this is the position of the player in All player</param> public ZhangFei(int pos, PlayerType type) : base(pos, Legends_of_the_Three_Kingdoms.Properties.Resources.Zhang_Fei, Legends_of_the_Three_Kingdoms.Properties.Resources.Zhang_Fei_has_no_restrictions_, 4, type) { }
public void Init(PlayerType yourStartPosition, GameConstraints gameConstraints) { startPosition = yourStartPosition; }
{ /// <summary> /// Create Lumeng /// </summary> /// <param name="pos">this is the position of the player in All player</param> public LuMeng(int pos, PlayerType type) : base(pos, Legends_of_the_Three_Kingdoms.Properties.Resources.Lu_Meng, Legends_of_the_Three_Kingdoms.Properties.Resources.If_Lu_Meng_does_not_use_any_At, 4, type) { }
/// <summary> /// parameterized constructor uses an existing id to create another player object /// </summary> /// <param name="id">int</param> public Player(int id, PlayerType type) { ID = id; m_Type = type; }
/// <summary> /// create LiuBei /// </summary> /// <param name="pos"> this is the position of the player in All player</param> public LiuBei(int pos, PlayerType type) : base(pos, Legends_of_the_Three_Kingdoms.Properties.Resources.Liu_Bei, Legends_of_the_Three_Kingdoms.Properties.Resources.Liu_Bei_s_can_give_any_number_, 4, type) { }
public void CreateAHumanPlayer(Type expectedType, PlayerType playerType) { var player = _playerFactory.Create(playerType, "Player 1"); Assert.IsType(expectedType, player); }
public void FillList(int amount, List <Control> controls, List <Control> allControls, PlayerType playerType, Panel board, Random random) { for (int i = 0; i < amount; i++) { Control newPlayer = new PictureBox() { Location = new Point(random.Next(20, 230), random.Next(20, 230)), Height = 10, Width = 10 }; switch (playerType) { case PlayerType.Human: newPlayer.BackColor = Color.Blue; break; case PlayerType.Soldier: newPlayer.BackColor = Color.DarkGreen; break; case PlayerType.Zombie: newPlayer.BackColor = Color.Red; break; } controls.Add(newPlayer); allControls.Add(newPlayer); board.Controls.Add(newPlayer); } }
public Boolean CheckWinner(PointIndex point, PlayerType state) { if (point == null) { throw new ArgumentNullException(nameof(point)); } for (Int32 x = 0; x < this.BoardSize; x++) { if (this.Board[x, point.Y] != state) { break; } if (x == this.BoardSize - 1) { this.GetWinnerMessage(state); this.WinnerState = true; return(true); } } for (Int32 y = 0; y < this.BoardSize; y++) { if (this.Board[point.X, y] != state) { break; } if (y == this.BoardSize - 1) { this.GetWinnerMessage(state); this.WinnerState = true; return(true); } } for (Int32 x = 0, y = 0; x < this.BoardSize && y < this.BoardSize; x++, y++) { if (this.Board[x, y] != state) { break; } if (x == this.BoardSize - 1 || y == this.BoardSize - 1) { this.GetWinnerMessage(state); this.WinnerState = true; return(true); } } for (Int32 x = this.BoardSize - 1, y = 0; x >= 0 && y < this.BoardSize; x--, y++) { if (this.Board[x, y] != state) { break; } if (x == 0 || y == this.BoardSize - 1) { this.GetWinnerMessage(state); this.WinnerState = true; return(true); } } this.CurrentTurnCount++; if (this.CurrentTurnCount == this.BoardSize * this.BoardSize) { this.GetWinnerMessage(state); this.WinnerState = true; return(true); } this.CurrentTurn = this.CurrentTurn == PlayerType.X ? PlayerType.O : PlayerType.X; return(false); }
public List <Koma> GetBoardKomaList(PlayerType player) { return(KomaList.Where(x => x.Player == player && x.IsOnBoard).ToList()); }
private static void ControlRod(PlayerType Player, FieldModel Field, RodModel Rod, Command Decision) { Anticipate Anticipated = Field.Ball.getRowIntersection(Rod.Column); int Coeff = Player == PlayerType.Host ? 1 : -1; if (Anticipated.Row == -1) { if (Rod.Position == RodPosition.Top) { Decision.MoveDown(Rod.Type); } else if (Rod.Position == RodPosition.Bottom) { Decision.MoveUp(Rod.Type); } else { Decision.NoAction(Rod.Type); } return; } if (!Rod.RowInPlayerReach(Anticipated.Row)) { // move to AnticipateDefend.Row if (Rod.Position == RodPosition.Middle && Anticipated.Row >= 6) { Decision.MoveDown(Rod.Type); } else if (Rod.Position == RodPosition.Middle) { Decision.MoveUp(Rod.Type); } else if (Rod.Position == RodPosition.Top) { Decision.MoveDown(Rod.Type); } else { Decision.MoveUp(Rod.Type); } return; } if (!Anticipated.Near) { Decision.NoAction(Rod.Type); return; } //Check here // Here the ball is in reach and the rod is in position and ready to shoot if (Anticipated.Column == (-1 * Coeff) && !(Player == PlayerType.Guest && Field.Ball.Column == 5)) { Decision.Kick(Rod.Type, DIRECTION.FORWARD, 1); return; } if (Anticipated.Column == 0) { Decision.Kick(Rod.Type, getKickDirection(Player, Anticipated.Row, 1), 1); } if (Anticipated.Column == (1 * Coeff)) { if (Rod.Type == RodType.Defense) { Decision.Kick(Rod.Type, getKickDirection(Player, Anticipated.Row, 5), 5); } else { Decision.Kick(Rod.Type, getGoalDirection(Player, Anticipated.Row), 5); } } }
public Koma FindKingOnBoard(PlayerType player) { // [MEMO:プレイヤーの王は盤上に1つのみあることを前提] return(KomaList.FirstOrDefault(x => x.Player == player && x.KomaType.IsKing && x.IsOnBoard)); }
private bool IsDestinationValid(int fromColumn, int toColumn, PieceType toPieceType, PlayerType playerInTurn) { switch (playerInTurn) { case PlayerType.Black: if (fromColumn != toColumn && toPieceType != PieceType.Black) { return(true); } if (fromColumn == toColumn && toPieceType == PieceType.None) { return(true); } break; case PlayerType.White: if (fromColumn != toColumn && toPieceType != PieceType.White) { return(true); } if (fromColumn == toColumn && toPieceType == PieceType.None) { return(true); } break; } return(false); }
public GameState(List <Koma> komaList, PlayerType turnPlayer, GameResult gameResult) { KomaList = komaList; TurnPlayer = turnPlayer; GameResult = gameResult; }
private void ChangeTurn() { isWhiteTurn = !isWhiteTurn; if (isWhiteTurn) { if (isPlayer1White) { turnText.text = player1 + "'s Turn"; AnimateAvatars(1); } else { turnText.text = player2 + "'s Turn"; AnimateAvatars(2); } if (whitePlayer == PlayerType.AI) { gameMode = PlayerType.AI; GetMove(); } else if (whitePlayer == PlayerType.Network) { gameMode = PlayerType.Network; GetMove(); } else if (whitePlayer == PlayerType.Local && blackPlayer == PlayerType.Local) { //enable white's emote button GameObject player1 = GameObject.FindGameObjectWithTag("Player1"); Button emote = player1.transform.GetChild(3).GetChild(2).gameObject.GetComponent <Button>(); emote.interactable = true; //disable black's emote button GameObject player2 = GameObject.FindGameObjectWithTag("Player2"); Button emote2 = player2.transform.GetChild(3).GetChild(2).gameObject.GetComponent <Button>(); emote2.interactable = false; } //play a sound for the character //PlayTurnChangeSoundEffect(whiteCharacter); } else if (isBlackTurn) { if (!isPlayer1White) { turnText.text = player1 + "'s Turn"; AnimateAvatars(1); } else { turnText.text = player2 + "'s Turn"; AnimateAvatars(2); } if (blackPlayer == PlayerType.AI) { gameMode = PlayerType.AI; GetMove(); } else if (blackPlayer == PlayerType.Network) { gameMode = PlayerType.Network; GetMove(); } else if (whitePlayer == PlayerType.Local && blackPlayer == PlayerType.Local) { //disable white's emote button GameObject player1 = GameObject.FindGameObjectWithTag("Player1"); Button emote = player1.transform.GetChild(3).GetChild(2).gameObject.GetComponent <Button>(); emote.interactable = false; //enable blacks's emote button GameObject player2 = GameObject.FindGameObjectWithTag("Player2"); Button emote2 = player2.transform.GetChild(3).GetChild(2).gameObject.GetComponent <Button>(); emote2.interactable = true; } //play a sound for the character //PlayTurnChangeSoundEffect(blackCharacter); } }
public List <Koma> GetKomaList(PlayerType player) { return(KomaList.Where(x => x.Player == player).ToList()); }