Exemple #1
0
 public void ResetVariables()
 {
     m_bunnyInside    = false;
     m_bunnySize      = 0;
     m_bunnyColour    = null;
     m_bunnyMouthPart = null;
     m_bunnyBackPart  = null;
 }
Exemple #2
0
 public void ResetVariables()
 {
     m_size      = RabboidCalculator.SMALL_SIZE;
     m_colour    = null;
     m_mouthPart = null;
     m_backPart  = null;
     m_isActive  = false;
 }
    string CalculateName(RabboidColour _color, float _size, RabboidBodyPart _mouthPart, RabboidBodyPart _backPart)
    {
        // Format = [SIZE] [BACK_MOD] & [MOUTH_MOD] [COLOR]-Rabboid
        string name = "";

        if (_size >= LARGE_SIZE)
        {
            name += "Large ";
        }
        else if (_size <= SMALL_SIZE)
        {
            name += "Small ";
        }

        if (_mouthPart && _backPart)
        {
            name += _backPart.m_modName + " & " + _mouthPart.m_modName + " ";
        }
        else
        {
            if (_mouthPart)
            {
                name += _mouthPart.m_modName + " ";
            }
            if (_backPart)
            {
                name += _backPart.m_modName + " ";
            }
        }

        if (_color)
        {
            name += _color.m_colourName + "-";
        }

        name += "Rabboid";

        return(name);
    }
    RabboidBodyPart MostFrequentBodyPart(List <RabboidBodyPart> _bodyPartList)
    {
        if (_bodyPartList.Count < 1)
        {
            return(null);
        }

        // Fill a dictionary
        Dictionary <RabboidBodyPart, uint> bodyDict = new Dictionary <RabboidBodyPart, uint>();

        foreach (RabboidBodyPart rbp in _bodyPartList)
        {
            if (!bodyDict.ContainsKey(rbp)) // New ID
            {
                bodyDict.Add(rbp, 1);
            }
            else
            {
                bodyDict[rbp] = bodyDict[rbp] + 1; // Increment no. of element
            }
        }

        // Find out which element comes up the most often
        uint            currentFreq = 0;
        RabboidBodyPart currentPart = null;

        foreach (KeyValuePair <RabboidBodyPart, uint> entry in bodyDict)
        {
            if (entry.Value > currentFreq)
            {
                currentFreq = entry.Value;
                currentPart = entry.Key;
            }
        }

        return(currentPart);
    }
Exemple #5
0
 public void AddMouthMod(RabboidBodyPart _new)
 {
     m_mouthModList.Add(_new);
 }
Exemple #6
0
 public void AddBackMod(RabboidBodyPart _new)
 {
     m_backModList.Add(_new);
 }