public void AddPlayerStartPriority(PlayerStartType type, Transform t, string source = "default") { WebGLComm.inst.Debug("added player start:" + type.ToString() + " from source;" + source); if (!playerStarts.ContainsKey(type)) { playerStarts.Add(type, t); } else { playerStarts[type] = t; } }
private IPlayer GetStartingPlayer(PlayerStartType playerStartType, IEnumerable <IPlayer> players) { if (!players.Any()) { throw new ArgumentException("invalid players"); } switch (playerStartType) { case PlayerStartType.FirstPlayerFirst: return(players.First()); case PlayerStartType.LastPlayerFirst: return(players.Last()); default: throw new ArgumentException("invalid player start type"); } }
public static IEnumerable <IPlayer> OrderBy(this IEnumerable <IPlayer> players, PlayerStartType playerStartType) { switch (playerStartType) { case PlayerStartType.FirstPlayerFirst: return(players); case PlayerStartType.LastPlayerFirst: return(players.Reverse()); default: throw new ArgumentException("invalid player start type"); } }