Example #1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        isConverterActive = gemConverter.converterActive;

        if (isConverterActive)
        {
            int manaCost = inventory.GetManaCost(color);
            mana.AdjustMana(-manaCost);
            Enumerations.color convertedColor = gemConverter.ConvertGemColor(color);
            inventory.UseGems(color, 1);
            inventory.AddGems(convertedColor, 1);
        }
        else if (!isConverterActive)
        {
            //check if number of gems is greater than 0
            if (currentGemNumber > 0)
            {
                wizard.OpenDoor(color);
            }
        }
    }