Example #1
0
    private void SwitchBodyType(int bodyTypeIndex)
    {
        // Deselect all other buttons
        this.DeselectBodies(bodyTypeIndex);
        PlayerPrefs.SetInt("BodyType", bodyTypeIndex);

        // Switch player model with new body type
        playerBodyCont.UpdateBodyModel(PlayerPrefs.GetInt("BodyInd"), bodyTypeIndex);

        // Switch track models with new body type
        for (int i = 0; i < bodyDisplayHelpers.Length; i++)
        {
            bodyDisplayHelpers[i].SetActiveBodyType(bodyTypeIndex);
        }
    }
    /// <summary>
    /// Select this button
    /// </summary>
    public void Select()
    {
        // Highlight the button
        this.HighlightButton();

        // Change hands
        if (gloves == true)
        {
            handTypeCont[0].UpdateHandModels(cosmeticIndex);
            handTypeCont[1].UpdateHandModels(cosmeticIndex);
            PlayerPrefs.SetInt("HandInd", cosmeticIndex);
        }
        else
        {
            playerBodyCont.UpdateBodyModel(cosmeticIndex, PlayerPrefs.GetInt("BodyType"));
            PlayerPrefs.SetInt("BodyInd", cosmeticIndex);
        }
    }