public TableSegment GetDirtiestSegment(bool playerRequired) { int _dirtIndex = -1; float _dirt = 0; for (int i = 0; i < Segments.Length; i++) { TableSegment current = Segments[i]; NetworkPlayer player = _slotter.GetPlayer(current.GetSlot()); if (playerRequired && player == null) { continue; } float disgustingValue = current.GetDisgustingValue(); if (disgustingValue > 0) { _dirt = disgustingValue; _dirt = i; } } if (_dirtIndex < 0) { return(null); } return(Segments[_dirtIndex]); }
public TableSegment GetSegment(NetworkPlayer player) { for (int i = 0; i < Segments.Length; i++) { TableSegment current = Segments[i]; PlayerSlot currentSlot = current.GetSlot(); if (_slotter == null) { _slotter = PlayerSlotter.Singleton(); } NetworkPlayer currentPlayer = _slotter.GetPlayer(currentSlot); if (currentPlayer == null) { continue; } if (currentPlayer == player) { return(current); } } return(null); }
void CheckSegments() { //Debug.Log("Checking Segments"); for (int i = 0; i < _tableSegments.Length; i++) { TableSegment current = _tableSegments[i]; if (current.GetDisgustingValue() > _distgustThreshold) { NetworkPlayer player = _slotter.GetPlayer(current.GetSlot()); if (player == null) { continue; } player.PunishPlayer(); // TODO: Punish player connected to segment } } }
public NetworkPlayer GetPlayer(TableSegment segment) { return(GetPlayer(segment.GetSlot())); }