Exemple #1
0
    public void Activate(bool m_bool)
    {
        if (m_bool)
        {
            Name.SetActive(true);
            effect.SetActive(true);
            transform.GetChild(0).gameObject.SetActive(true);

            if (TooltipObject.GetComponent <MelodyBehaviour>() != null)
            {
                Melodies.Melody melody = TooltipObject.GetComponent <MelodyBehaviour>().melody;
                inspiration.SetActive(true);
                trance.SetActive(true);
                target.SetActive(true);
                type.SetActive(true);

                Name.GetComponent <Text>().text        = Utils.SplitPascalCase(melody.name);
                effect.GetComponent <Text>().text      = melody.effect;
                inspiration.GetComponent <Text>().text = stringInspiration(melody);
                trance.GetComponent <Text>().text      = stringTrance(melody);
                type.GetComponent <Text>().text        = "Tier " + melody.tier; //add trance melody possibility
                target.GetComponent <Text>().text      = melodyTargetToString(melody.targetMode);
            }

            if (TooltipObject.GetComponent <InstrumentBehaviour>() != null)
            {
                Bard.Instrument instrument = TooltipObject.GetComponent <InstrumentBehaviour>().instrument;
                type.SetActive(true);

                Name.GetComponent <Text>().text   = Utils.SplitPascalCase(instrument.name);
                effect.GetComponent <Text>().text = instrument.passif;
                type.GetComponent <Text>().text   = instrument.type;
            }

            if (TooltipObject.GetComponent <SkillBehaviour>() != null)
            {
                Skills.Skill skill = TooltipObject.GetComponent <SkillBehaviour>().skill;
                target.SetActive(true);

                Name.GetComponent <Text>().text   = Utils.SplitPascalCase(skill.name);
                effect.GetComponent <Text>().text = skill.description;
                target.GetComponent <Text>().text = skillTargetToString(skill.actions);
            }
        }
        else
        {
            Name.SetActive(false);
            effect.SetActive(false);
            target.SetActive(false);
            inspiration.SetActive(false);
            trance.SetActive(false);
            type.SetActive(false);
            transform.GetChild(0).gameObject.SetActive(false);
        }
    }
    public void PurchaseInstrument(Bard.Instrument instrument)
    {
        GameObject goldManager = GameObject.FindGameObjectWithTag("GoldLabel");

        if (goldManager.GetComponent <GoldValue>().HasEnoughGold(instrument.price))
        {
            goldManager.GetComponent <GoldValue>().Pay(instrument.price);
            instrument.owned = true;
            UpdateInstrumentShop();
        }
        else
        {
            goldManager.GetComponent <GoldValue>().DisplayNoGoldMessage();
        }
    }
    public void OnPointerClick(PointerEventData pointerEventData)
    {
        if (!IsClickable)
        {
            return;
        }

        if (transform.parent.GetComponent <SlotBehaviour>() != null)
        {
            this.instrument = null;
            this.enabled    = false;
            gameObject.GetComponent <Image>().sprite  = null;
            gameObject.GetComponent <Image>().enabled = false;
            transform.parent.GetComponent <SlotBehaviour>().Slotted = false;

            transform.parent.GetComponentInParent <TheodoreMenuManager>().SelectedSkill -= 4;
        }
        else
        {
            if (findSlot(instrumentSlots) == -1)
            {
                return;
            }

            slot = instrumentSlots[findSlot(instrumentSlots)];

            GameObject slottedSkill = slot.transform.GetChild(0).gameObject;
            slottedSkill.GetComponent <InstrumentBehaviour>().instrument = instrument;
            slottedSkill.GetComponent <InstrumentBehaviour>().enabled    = true;
            slottedSkill.GetComponent <Image>().color   = GetComponent <Image>().color;
            slottedSkill.GetComponent <Image>().sprite  = GetComponent <Image>().sprite;
            slottedSkill.GetComponent <Image>().enabled = true;

            slot.GetComponent <SlotBehaviour>().Slotted = true;

            foreach (Melodies.Melody melody in instrument.melodies)
            {
                displayMelody(instrumentSkillSlots, melody);
            }

            IsClickable = false;
            slottedSkill.GetComponent <Button>().onClick.AddListener(() => { IsClickable = true; });
            slottedSkill.GetComponent <Button>().interactable = true;
            warning.transform.GetChild(1).GetComponent <Button>().onClick.AddListener(() => { IsClickable = true; });
            transform.parent.GetComponentInParent <TheodoreMenuManager>().SelectedSkill += 4;
        }
    }
Exemple #4
0
    // Start is called before the first frame update
    void Start()
    {
        purchaseButton = GameObject.Find("PurchaseButton");
        purchaseButton.GetComponent <Button>().interactable = false;

        for (int i = 0; i < instrumentsButtons.Count; i++)
        {
            Bard.Instrument instrument = instruments[i];
            Button          button     = instrumentsButtons[i];
            string          instruName = instrumentsButtons[i].name;
            Debug.Log(instruName);
            GameObject.Find(instruName + "_Image").GetComponent <Image>().sprite = instrument.sprite;
            GameObject.Find(instruName + "_Name").GetComponent <Text>().text     = Utils.SplitPascalCase(instrument.name);
            GameObject.Find(instruName + "_Price").GetComponent <Text>().text    = instrument.price + "G";

            UpdateInstrumentShop();
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        for (int i = 0; i < instrumentsButtons.Count; i++)
        {
            Bard.Instrument instrument = instruments[i];
            string          instruName = instrumentsButtons[i].name;
            GameObject.Find(instruName + "_Image").GetComponent <Image>().sprite    = instrument.sprite;
            GameObject.Find(instruName + "_Image").GetComponent <Image>().color     = instrument.color;
            GameObject.Find(instruName + "_Name").GetComponent <Text>().text        = Utils.SplitPascalCase(instrument.name);
            GameObject.Find(instruName + "_Description").GetComponent <Text>().text = instrument.passif;
            GameObject.Find(instruName + "_Price").GetComponent <Text>().text       = instrument.price + "G";

            for (int j = 0; j < 4; j++)
            {
                GameObject.Find(instruName + "_Melody" + j.ToString()).GetComponent <Text>().text = Utils.SplitPascalCase(instrument.melodies[j].name)
                                                                                                    + " : "
                                                                                                    + instrument.melodies[j].effect;
            }

            UpdateInstrumentShop();
        }
    }