Esempio n. 1
0
    public void RemoveAtomA()
    {
        if (atomA != null && atomChoices.Count > atomA.GetAtomicNumber())
        {
            ChoiceOption choiceOption = atomChoices[atomA.GetAtomicNumber() - 1];
            var          atom         = atomA;
            choiceOption.SetButtonEvent(() => {
                SetAtom(atom);
                AudioManager.Instance.PlaySound(choiceClickSound);
            });
            choiceOption.SetColors(ChoiceOption.defaultNormalColor, ChoiceOption.defaultHoverColor, ChoiceOption.defaultPressedColor);
            choiceOption.SetFocus(false);
        }

        //if (atomA != null) {
        //    atomChoices[atomA.GetAtomicNumber() - 1].SetInteractable(true);
        //}
        atomA = null;

        AtomInfo info = Game.Instance.gameData.GetUknownInfo();

        atomAText.text    = info.GetAtom().GetName();
        atomAImage.sprite = info.GetImage();

        splitBtn.interactable  = false;
        infoText.text          = "";
        atomResultImage.sprite = info.GetImage();
        atomResultText.text    = info.GetAtom().GetName();
        atomAAmoText.text      = "";
        atomAAmo.value         = 0;

        atomABtn.interactable = false;
    }
Esempio n. 2
0
    public void RemoveUpgrade()
    {
        if (choices.Count > (int)currUpgradeType)
        {
            ChoiceOption choiceOption = choices[(int)currUpgradeType];
            var          type         = currUpgradeType;
            choiceOption.SetButtonEvent(() => {
                SetUpgradeInfo(type);
                AudioManager.Instance.PlaySound(choiceClick);
            });
            choiceOption.SetColors(ChoiceOption.defaultNormalColor, ChoiceOption.defaultHoverColor, ChoiceOption.defaultPressedColor);
            choiceOption.SetFocus(false);
        }

        upgradeName.text      = "Upgrade";
        upgradeDesc.text      = "";
        upgradeCurrValue.text = "Curr Value: ";
        upgradeNextValue.text = "Next Value: ";

        upgradeAtomNeed.text = "";
        upgradeAtomName.text = "";
        upgradeAtomHave.text = "";

        upgradeBtn.interactable = false;
    }
Esempio n. 3
0
    public void SetAtomA(Atom atom)
    {
        if (atom != null && atomChoices.Count > atom.GetAtomicNumber())
        {
            ChoiceOption choiceOption = atomChoices[atom.GetAtomicNumber() - 1];
            choiceOption.SetButtonEvent(() => {
                RemoveAtomA();
                AudioManager.Instance.PlaySound(choiceClickSound);
            });
            choiceOption.SetColors(ChoiceOption.defaultPressedColor, ChoiceOption.defaultHoverColor, ChoiceOption.defaultNormalColor);
            choiceOption.SetFocus(false);
        }

        atomA = atom;
        //atomChoices[atomA.GetAtomicNumber() - 1].SetInteractable(false);

        AtomInfo info = Game.Instance.gameData.FindAtomInfo(atom.GetAtomicNumber());
        AtomData data = Game.Instance.gameData.FindAtomData(atom.GetAtomicNumber());

        atomAText.text    = info.GetAtom().GetName();
        atomAImage.sprite = info.GetImage();

        atomAAmo.maxValue = data.GetCurrAmo();
        SetAtomAAmoText();

        atomABtn.interactable = true;
    }
Esempio n. 4
0
    public void SetUpgradeInfo(PlayerData.UpgradeType type)
    {
        RemoveUpgrade();
        if ((int)type >= choices.Count)
        {
            return;
        }

        // Button Stuff
        ChoiceOption choiceOption = choices[(int)type];

        choiceOption.SetButtonEvent(() => {
            RemoveUpgrade();
            AudioManager.Instance.PlaySound(choiceClick);
        });
        choiceOption.SetColors(ChoiceOption.defaultPressedColor, ChoiceOption.defaultHoverColor, ChoiceOption.defaultNormalColor);
        choiceOption.SetFocus(false);
        currUpgradeType = type;

        // Display Stuff
        List <AtomAmo> atomsNeeded = Game.Instance.playerData.GetCost(type);

        upgradeName.text = Game.Instance.playerData.GetName(type);
        upgradeDesc.text = Game.Instance.playerData.GetDescription(type);
        double currValue = System.Math.Round(Game.Instance.playerData.GetValue(type), 3);
        double nextValue = System.Math.Round(Game.Instance.playerData.GetNextValue(type), 3);

        if (type == PlayerData.UpgradeType.Collect_Efficiency)
        {
            currValue *= 100;
            nextValue *= 100;
        }
        upgradeCurrValue.text = "Curr Value: " + currValue + " " +
                                Game.Instance.playerData.GetMeasurementAbbr(type); //currValue;
        upgradeNextValue.text = "Next Value: " + nextValue + " " +
                                Game.Instance.playerData.GetMeasurementAbbr(type); //nextValue;

        bool canCraft = true;

        upgradeAtomName.text = "";
        upgradeAtomNeed.text = "";
        upgradeAtomHave.text = "";
        for (int i = 0; i < atomsNeeded.Count; i++)
        {
            AtomAmo cost = atomsNeeded[i];
            if (cost.atom == null)
            {
                continue;
            }

            int amoHave = Game.Instance.gameData.FindAtomData(cost.atom.GetAtomicNumber()).GetCurrAmo();
            if (amoHave >= cost.amo)
            {
                upgradeAtomName.text += cost.atom.GetName() + "\n";
                upgradeAtomNeed.text += cost.amo + "\n";
                upgradeAtomHave.text += amoHave + "\n";
            }
            else
            {
                upgradeAtomName.text += "<color=#ff8080>" + cost.atom.GetName() + "\n</color>";
                upgradeAtomNeed.text += "<color=#ff8080>" + cost.amo + "\n</color>";
                upgradeAtomHave.text += "<color=#ff8080>" + amoHave + "\n</color>";
                canCraft              = false;
            }
        }
        upgradeBtn.interactable = canCraft;
    }