public void SetTechnology(Technology tech)
    {
        technology = tech;

        // Initialize list if necessary
        if (TechnologyController.instance.techListStates == null)
        {
            TechnologyController.instance.techListStates = new List <Technology>();
        }

        // If technology controller singleton does not contain the current technology add to the list (should only happen on game launch)
        if (!TechnologyController.instance.techListStates.Exists(t => t.displayName == technology.displayName))
        {
            TechnologyController.instance.techListStates.Add(technology);
            TechnologyController.instance.techProgress.Add(technology, technology.researchCost);
            technology.isLocked = true;
        }

        // Mandatory setup tasks
        panelBackground = GetComponent <Image>();
        display         = GetComponentInParent <ResearchDisplay>();
        hoverPanel.SetActive(false);

        // Technology Setup
        displayTitle.text       = technology.displayName;
        displayDescription.text = technology.description;
        techIconLocked.sprite   = technology.lockedImage;
        int researchTime = technology.researchCost;

        if (researchSpeed != 0)
        {
            researchTime /= researchSpeed;
        }

        researchCost.text = researchTime.ToString();
        hoverPanel.GetComponent <ResearchToolTips>().SetToolTipSize(displayTitle, displayDescription);
        ShowCanUnlockImage();
    }
示例#2
0
 // Start is called before the first frame update
 void Awake()
 {
     display = GetComponentInParent <ResearchDisplay>();
 }