public List <NetworkPlayer> GetDirtiesPlayers()
    {
        List <NetworkPlayer> awarded = new List <NetworkPlayer>();
        float dirtValue = 0;

        for (int i = 0; i < Segments.Length; i++)
        {
            TableSegment  current = Segments[i];
            NetworkPlayer player  = _slotter.GetPlayer(current);

            if (player == null)
            {
                continue;
            }

            float value = current.GetDisgustingValue();

            if (value > dirtValue)
            {
                dirtValue = value;
                awarded.Clear();

                awarded.Add(player);
            }
            else if (value == dirtValue)
            {
                awarded.Add(player);
            }
        }

        return(awarded);
    }
    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]);
    }
예제 #3
0
    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
            }
        }
    }