public bool RemoveSpectatingPlayer(Spectator spectator) { foreach (Spectator spec in spectators) { if (spec.Id == spectator.Id) { spectators.Remove(spec); return(true); } } return(false); }
public Spectator AddSpectatingPlayer(User user) { if (!Pref.SpectateGame) { throw new DomainException("game not spectatable"); } if (IsSpectatorExist(user.Username)) { throw new DomainException("the user " + user + " is already watching this game"); } Spectator spec = new Spectator(user.Username); spectators.Add(spec); return(spec); }
public bool RemoveSpectatingPlayer(Spectator spectator) { return(MyGame.RemoveSpectatingPlayer(spectator)); }