예제 #1
0
    /// <summary>
    /// Equips this ball customization
    /// </summary>
    private void Equip()
    {
        equip.GetComponent <Text>().text = "Equipped";

        Outline line = gameObject.AddComponent <Outline>();

        line.effectDistance  = new Vector2(3, -3);
        line.effectColor     = Color.blue;
        line.useGraphicAlpha = false;

        if (gameObject.name.Contains("Trail"))
        {
            PlayerPrefs.SetInt("Trail", id);
            customizationManager.UpdateCurrentTrail(id);
        }
        else
        {
            PlayerPrefs.SetInt("Ball", id);
            customizationManager.UpdateCurrentBall(id);
        }

        // Set the customization to be the new selection
        if (gameObject.name.Contains("Trail"))
        {
            PlayerPrefs.SetString("CurrentTrail", gameObject.name);
        }
        else
        {
            PlayerPrefs.SetString("CurrentBall", gameObject.name);
        }


        state = BuyState.Equipped;
        string key = gameObject.name + "BuyState";

        PlayerPrefs.SetInt(key, (int)state);
    }