public GameStageTests() { Player player1 = new Player("IvanOne"); Player player2 = new Player("GoshoOne"); Player player3 = new Player("PetjoTwo"); Player player4 = new Player("IvanooTwo"); Player player5 = new Player("BorkoThree"); Player player6 = new Player("PetqThree"); Player player7 = new Player("HristoFour"); Player player8 = new Player("PeturFour"); //Arrange var teamOne = new Team(); var teamTwo = new Team(); var teamThree = new Team(); var teamFour = new Team(); teamOne.Members.Add(player1); teamOne.Members.Add(player2); teamTwo.Members.Add(player3); teamTwo.Members.Add(player4); teamThree.Members.Add(player5); teamThree.Members.Add(player6); teamFour.Members.Add(player7); teamFour.Members.Add(player8); Teams = new List <Team> { teamOne, teamTwo, teamThree, teamFour }; PlayerOrder = new PlayerOrder(Teams, false); Words = new Queue <string>(); }
//Initialize game on startup void Awake() { for (int i = 0; i < 4; i++) { PlayerOrder playerO = new PlayerOrder(); bool temp = true; if (GameHandler.instance.players [i].isPlaying) { ramenMachines [i].gameObject.SetActive(true); } for (int x = 0; x < ramenOrders.Count; x++) { playerO.matching.Add(temp); } ramenMachines [i].mgScript = this; pOrder.Add(playerO); } for (int i = 0; i < ramenOrders.Count; i++) { ramenOrders [i].mgScript = this; ramenOrders [i].AssignOrder(); } //Subscribe to button inputs InputHandler.ButtonPressed += this.ButtonPress; StartCoroutine("ShowAllOrders"); }
private void Start() { playerOrder = new PlayerOrder(nPlayers); playerOrder.Shuffle(); actionPoints = new int[nPlayers]; requiredBoardMoves = new int[nPlayers]; RefillActionPoints(); }
void OnReceiveOrder(PlayerOrder order) { if (order.posture.HasValue) { OnPostureChanged(order.posture.Value); } if (order.actionCallback != null) { order.actionCallback(); } }
/// <summary> /// Moves to the next player in the turn cycle. /// If we move back to the starting player, then all players mana is increased. /// </summary> public void NextPlayer() { PlayerOrder.Enqueue(PlayerOrder.Dequeue()); if (CurrentPlayerId == StartingPlayerId) { foreach (IPlayer player in Players.Values) { player.MaxMana += 5; // mana is increased each full cycle of players (this will need tweaking) } } CurrentPlayer.Mana = CurrentPlayer.MaxMana; }
private void SortPlayers() { PlayerOrder ord = view.AskPlayerOrder(); switch (ord) { case PlayerOrder.ByScore: list.Sort(); break; case PlayerOrder.ByName: list.Sort(compareByName); break; case PlayerOrder.ByNameReverse: list.Sort(compareByNameReverse); break; } }
public void AttackPossition(float x, float y, float z) => PlayerOrder.PrepareUnitOrders(EntityPointer, (int)Order.AttackLocation, 0, x, y, z, 0, OrderIssuer.DotaOrderIssuerSelectedUnits, null, false, true);
public void UseGlyph() => PlayerOrder.PrepareUnitOrders(EntityPointer, (int)Order.GlyphOfFortification, 0, 0, 0, 0, 0, OrderIssuer.DotaOrderIssuerHeroOnly, null, false, true);
private Brush GetPlayerBrush(PlayerOrder playerDescription) { return(playerDescription == PlayerOrder.First ? FirstPlayerBrush : SecondPlayerBrush); }
public void Stop() => PlayerOrder.PrepareUnitOrders(EntityPointer, (int)Order.Stop, 0, 0, 0, 0, 0, OrderIssuer.DotaOrderIssuerSelectedUnits, null, false, true);
public void UseBuyback() => PlayerOrder.PrepareUnitOrders(EntityPointer, (int)Order.Buyback, 0, 0, 0, 0, 0, OrderIssuer.DotaOrderIssuerHeroOnly, null, false, true);
public void MoveToPosition(int x, int y, int z) => PlayerOrder.PrepareUnitOrders(EntityPointer, (int)Order.AttackTarget, 0, x, y, z, 0, OrderIssuer.DotaOrderIssuerSelectedUnits, null, false, true);
public void MoveToTarget(Entity targetEntity) => PlayerOrder.PrepareUnitOrders(EntityPointer, (int)Order.MoveTarget, targetEntity.Index(), 0, 0, 0, 0, OrderIssuer.DotaOrderIssuerSelectedUnits, null, false, true);
public void HoldPosition() => PlayerOrder.PrepareUnitOrders(EntityPointer, (int)Order.Hold, 0, 0, 0, 0, 0, OrderIssuer.DotaOrderIssuerSelectedUnits, null, false, true);
public List <Player> GetPlayerOrder(Game game, RoundAction roundAction) { List <Player> playerOrder = new List <Player>(); var raEntity = db.RoundActions.Include("PlayerAnswers.Player").Include("PlayerAnswers.AnswerGiven").Where(r => r.Id == roundAction.Id).FirstOrDefault(); List <PlayerAnswer> playersWithValidAnswer = new List <PlayerAnswer>(); //Creates a list of valid player answers foreach (PlayerAnswer pa in raEntity.PlayerAnswers) { if (pa.AnswerGiven.IsValid) { playersWithValidAnswer.Add(pa); } } //Orders the playerAnswers by the fastest valid answer first to the slowest playersWithValidAnswer.OrderBy(pa => pa.PlayerAnswerTime.Ticks).ToList(); foreach (PlayerAnswer pa in playersWithValidAnswer) { playerOrder.Add(pa.Player); } List <Player> playersWithoutValidAnswer = new List <Player>(); foreach (Player p in game.Players) { Player found = playerOrder.Where(po => po.Id == p.Id).FirstOrDefault(); if (found == null) { playersWithoutValidAnswer.Add(p); } } playersWithoutValidAnswer.Shuffle(); foreach (Player p in playersWithoutValidAnswer) { playerOrder.Add(p); } //for (int i = 0; i < playerOrder.Count; i++) //{ // int pId = playerOrder[i].Id; // if (!db.PlayerOrders.Any(p => p.GameId == game.Id && p.PlayerId == pId)) // { // PlayerOrder po = new PlayerOrder { GameId = game.Id, PlayerId = pId, Position = (i + 1) }; // db.PlayerOrders.Add(po); // } //} int i = 0; foreach (Player p in playerOrder) { PlayerOrder po = new PlayerOrder { GameId = game.Id, PlayerId = playerOrder[i].Id, Position = (i + 1) }; db.PlayerOrders.Add(po); i++; } db.SaveChanges(); return(playerOrder); }
public void AbilityTarget(Entity targetEntity, Ability usedAbility) => PlayerOrder.PrepareUnitOrders( EntityPointer, (int)Order.AbilityTarget, targetEntity.Index(), 0, 0, 0, usedAbility.Index(), OrderIssuer.DotaOrderIssuerPassedUnitOnly, AssignedHero(), false, true);
public void AbilityLocation(float x, float y, float z, Ability usedAbility) => PlayerOrder.PrepareUnitOrders( EntityPointer, (int)Order.AbilityTarget, 0, x, y, z, usedAbility.Index(), OrderIssuer.DotaOrderIssuerPassedUnitOnly, AssignedHero(), false, true);
public Move(PlayerOrder playerDescription, Point to, Point from) { PlayerOrder = playerDescription; To = to; From = from; }