コード例 #1
0
    public void SetProfession(PersonAttribute profession)
    {
        mProfession = profession;
        this.name   = mProfession.ToString();
        // Update visuals
        transform.Find("Top bar/Icon").GetComponent <Image>().sprite = Utilities.GetSpriteManager().GetSprite(mProfession);
        Color32 profColor = mProfession.GetColor();

        // Color the background based on the profession's associated color
        GetComponent <Image>().color = new Color32(profColor.r, profColor.g, profColor.b, 30);
        // TODO: use the associated profession's color for icon color once the icons are white
        //transform.Find("Top bar/Icon").GetComponent<Image>().color = ;
        string labelString = string.Format(
            "{0} ({1} + {2}/lvl)",
            mProfession.GetDescription(),
            mProfession.GetEfficiencyBase(),
            mProfession.GetEfficiencyPerLevel());

        transform.Find("Top bar/Text").GetComponent <Text>().text = labelString;
    }
コード例 #2
0
 public static float GetEfficiencyPerLevel(this PersonAttribute attr)
 {
     // For now all professions get 50% more effective per level.
     return(attr.GetEfficiencyBase() / 2f);
 }