Exemplo n.º 1
0
    public void AddAttributePoint(int id)
    {
        if (CharacterInfo._instance._baseProperties.AttributePoint >= 1)
        {
            switch (id)
            {
            case 0:
                StartCoroutine(ServerAdapter.AddAttributePoint(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, 1, "vitality", result =>
                {
                    if (result.StartsWith("Error"))
                    {
                        Debug.Log("Do nothing");
                    }
                    else
                    {
                        CharacterInfo._instance._baseProperties.AttributePoint--;
                        CharacterInfo._instance._baseProperties.Vitality++;
                        UpdateTxtValueProperties();
                    }
                }));
                break;

            case 1:
                StartCoroutine(ServerAdapter.AddAttributePoint(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, 1, "strength", result =>
                {
                    if (result.StartsWith("Error"))
                    {
                        Debug.Log("Do nothing");
                    }
                    else
                    {
                        CharacterInfo._instance._baseProperties.AttributePoint--;
                        CharacterInfo._instance._baseProperties.Strength++;
                        UpdateTxtValueProperties();
                    }
                }));
                break;

            case 2:
                StartCoroutine(ServerAdapter.AddAttributePoint(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, 1, "intelligence", result =>
                {
                    if (result.StartsWith("Error"))
                    {
                        Debug.Log("Do nothing");
                    }
                    else
                    {
                        CharacterInfo._instance._baseProperties.AttributePoint--;
                        CharacterInfo._instance._baseProperties.Intelligence++;
                        UpdateTxtValueProperties();
                    }
                }));
                break;
            }
        }
    }