Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 2
0
        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");
            }
        }
Ejemplo n.º 3
0
        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");
            }
        }