Example #1
0
 public void Init()
 {
     gameObject.SetActive(true);
     character = new Character();
     character.Init();
     character.CalcStats();
     costs = new Costs(character);
     costs.CalcAll();
 }
Example #2
0
    public void Refresh()
    {
        costs.CalcAll();
        character.CalcStats();
        GameObject.Find("Texts/ST").GetComponent <Text>().text           = character.st.ToString();
        GameObject.Find("Texts/ST Cost/Cost").GetComponent <Text>().text = costs.st.ToString();
        GameObject.Find("Texts/DX").GetComponent <Text>().text           = character.dx.ToString();
        GameObject.Find("Texts/DX Cost/Cost").GetComponent <Text>().text = costs.dx.ToString();
        GameObject.Find("Texts/IQ").GetComponent <Text>().text           = character.iq.ToString();
        GameObject.Find("Texts/IQ Cost/Cost").GetComponent <Text>().text = costs.iq.ToString();
        GameObject.Find("Texts/HT").GetComponent <Text>().text           = character.ht.ToString();
        GameObject.Find("Texts/HT Cost/Cost").GetComponent <Text>().text = costs.ht.ToString();
        Text total = GameObject.Find("Texts/Total").GetComponent <Text>();

        total.text = "Total: " + costs.total + " points";
        if (costs.total > 100)
        {
            total.color = Color.red;
        }
        else
        {
            total.color = Color.black;
        }
    }