示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        HUD          = CanvasHUD.GetComponent <CanvasHUD>();
        lastTownInfo = GameObject.FindWithTag("GameManager");

        var ifNameMatchesDictionary = transferInfoToOtherScene.townInformation.ContainsKey(cityName);

        if (ifNameMatchesDictionary)
        {
            population = transferInfoToOtherScene.townInformation[cityName][0].ToString();
            income     = transferInfoToOtherScene.townInformation[cityName][1].ToString();
        }
        else
        {
            population = "??";
            income     = "??";
        }
    }
    void Start()
    {
        incrementGold       = 100;
        incrementSacrifices = 10;
        HUD            = CanvasHUD.GetComponent <CanvasHUD>();
        mouseHovering  = false;
        childText      = GameObject.Find("Text");
        humanSacrifice = transferInfoToOtherScene.availableSacrifice;
        gold           = transferInfoToOtherScene.totalIncome;

        Text txt = transform.Find("Text").GetComponent <Text>();

        if (gameObject.tag == "infoManager")
        {
            txt.text = "Gold Available: " + gold + "\n" + "Human Sacrifices: " + humanSacrifice;
        }
        if (gameObject.tag == "Health")
        {
            attribute    = "Health";
            name         = "Increased Health";
            descritption = "Increase your dragon's hitpoints";
            txt.text     = healthLvl.ToString();
        }
        else if (gameObject.tag == "Speed")
        {
            attribute    = "Speed";
            descritption = "Increase your dragon's speed";
            name         = "Increase Speed";

            txt.text = speedLvl.ToString();
        }
        else if (gameObject.tag == "Attack")
        {
            attribute    = "Strength";
            descritption = "Increase your dragon's attack";
            name         = "Increase Attack Power";
            txt.text     = strengthLvl.ToString();
        }
        else if (gameObject.tag == "Fire")
        {
            attribute    = "Fire";
            descritption = "Increase your dragon's fire power and rate of spreading";
            name         = "Increase Fire Power";
            txt.text     = fireLvl.ToString();
        }
        else if (gameObject.tag == "Defense")
        {
            attribute    = "Defense";
            descritption = "Reduces chances of being hit";
            name         = "Increase Defense";
            txt.text     = defenseLvl.ToString();
        }
        else if (gameObject.tag == "Rage")
        {
            attribute    = "Rage";
            descritption = "Dragon is less likely to rage";
            name         = "Reduce Rage Chance";
            txt.text     = rageLvl.ToString();
        }
        else if (gameObject.tag == "Evolve")
        {
            attribute    = "Evolve";
            descritption = "Dragon becomes stronger overall";
            name         = "Evolve to next stage";
            txt.text     = evolveLvl.ToString();
        }



        if (!requirements.ContainsKey("Evolve"))
        {
            foreach (string att in attributes)
            {
                List <int> listGoldSacrifice = new List <int>();
                listGoldSacrifice.Add(100);
                listGoldSacrifice.Add(10);
                requirements.Add(att, listGoldSacrifice);
            }
        }
        cost = "Requirements: \n Gold: " + requirements[attribute][0].ToString() + "Sacrifices:" + requirements[attribute][1].ToString();
    }