Example #1
0
    public BaseChar()
    {
        charName  = "Joe Doe";
        charClass = Classes.Stormer;
        level     = 1;
        exp       = 0;
        weight    = 70;
        height    = 180;
        image     = new Texture2D(0, 0);
        Items     = new Inventory(new Item[0]);

        attributes    = new BaseStat[Enum.GetValues(typeof(AttrNames)).Length];
        secondaryAttr = new ModifiedStat[Enum.
                                         GetValues(typeof(SecondaryAttrNames)).Length];

        for (int i = 0; i < attributes.Length; i++)
        {
            attributes[i] = new BaseStat(((AttrNames)i).ToString());
        }
        for (int i = 0; i < secondaryAttr.Length; i++)
        {
            secondaryAttr[i] = new ModifiedStat(((SecondaryAttrNames)i).ToString(),
                                                this);
        }
        setupModifiers();
        CalcSecondaryAttr();
    }
Example #2
0
    public BaseChar(string charName, int level, int exp, Class charClass,
                    Texture2D image) : this()
    {
        this.charName  = charName;
        this.level     = level;
        this.exp       = exp;
        this.charClass = charClass;
        this.image     = image;

        attributes    = new BaseStat[Enum.GetValues(typeof(AttrNames)).Length];
        secondaryAttr = new ModifiedStat[Enum.
                                         GetValues(typeof(SecondaryAttrNames)).Length];

        for (int i = 0; i < attributes.Length; i++)
        {
            attributes[i] = new BaseStat(((AttrNames)i).ToString());
        }
        setAttributeDescriptions();

        for (int i = 0; i < secondaryAttr.Length; i++)
        {
            secondaryAttr[i] = new ModifiedStat(((SecondaryAttrNames)i).ToString(),
                                                this);
        }
        setSecondaryAttributeDescriptions();

        setupModifiers();
        CalcSecondaryAttr();
    }
Example #3
0
    public BaseChar(string charName, int level, int exp, Class charClass, 
        Texture2D image): this()
    {
        this.charName = charName;
        this.level = level;
        this.exp = exp;
        this.charClass = charClass;
        this.image = image;

        attributes = new BaseStat[Enum.GetValues(typeof(AttrNames)).Length];
        secondaryAttr = new ModifiedStat[Enum.
            GetValues(typeof(SecondaryAttrNames)).Length];

        for (int i = 0; i < attributes.Length; i++)
            attributes[i] = new BaseStat(((AttrNames)i).ToString());
        setAttributeDescriptions();

        for (int i = 0; i < secondaryAttr.Length; i++)
            secondaryAttr[i] = new ModifiedStat(((SecondaryAttrNames)i).ToString(),
                this);
        setSecondaryAttributeDescriptions();

        setupModifiers();
        CalcSecondaryAttr();
    }
Example #4
0
    public BaseChar()
    {
        charName = "Joe Doe";
        charClass = Classes.Stormer;
        level = 1;
        exp = 0;
        weight = 70;
        height = 180;
        image = new Texture2D(0, 0);
        Items = new Inventory(new Item[0]);

        attributes = new BaseStat[Enum.GetValues(typeof(AttrNames)).Length];
        secondaryAttr = new ModifiedStat[Enum.
            GetValues(typeof(SecondaryAttrNames)).Length];

        for (int i = 0; i < attributes.Length; i++)
            attributes[i] = new BaseStat(((AttrNames)i).ToString());
        for (int i = 0; i < secondaryAttr.Length; i++)
            secondaryAttr[i] = new ModifiedStat(((SecondaryAttrNames)i).ToString(), 
                this);
        setupModifiers();
        CalcSecondaryAttr();
    }
Example #5
0
    void showCharacterInfo(BaseChar selectedChar)
    {
        GUIContent content;

        GUI.DrawTexture(new Rect(567, 29, 76, 84), selectedChar.Image,
                        ScaleMode.ScaleToFit, true);
        GUI.Label(new Rect(648, 29, 150, 20), selectedChar.charName, "title");
        GUI.Label(new Rect(648, 49, 150, 20),
                  "Class: " + selectedChar.CharClass.Name, "title");
        GUI.Label(new Rect(648, 69, 150, 20), "Level: " + selectedChar.level,
                  "title");

        for (int i = 0; i < selectedChar.getAttributes().Length; i++)
        {
            BaseStat attribute = selectedChar.getAttr(i);
            content = new GUIContent(attribute.Name, attribute.description);
            GUI.Label(new Rect(571, 115 + i * 17, 100, 23), content);
            GUI.Label(new Rect(676, 115 + i * 17, 30, 23),
                      attribute.Value.ToString());
        }

        int nrOfPrimaryAttr = System.Enum.GetValues(typeof(AttrNames)).Length;
        int offset          = 128 + nrOfPrimaryAttr * 17;

        for (int i = 0; i < selectedChar.getSecondaryAttributes().Length; i++)
        {
            ModifiedStat secAttr  = selectedChar.getSecondaryAttr(i);
            string       attrName = secAttr.Name.Replace('_', ' ');
            content = new GUIContent(attrName, secAttr.description);
            GUI.Label(new Rect(571, offset + i * 18, 150, 23), content);
            if (i == (int)SecondaryAttrNames.Hit_Points)
            {
                GUI.Label(new Rect(715, offset + i * 18, 58, 23),
                          selectedChar.CurrentHP.ToString() + "/" +
                          secAttr.Value.ToString(), "AttrValues");
                offset += 23;
                Texture2D PBEmpty, PBFull;
                PBEmpty = Helper.getImage("Inventory/ProgressBarEmpty");
                PBFull  = Helper.getImage("Inventory/ProgressBarFull");
                float totalHP = selectedChar.LostHP + selectedChar.CurrentHP;
                GUI.DrawTexture(new Rect(571, offset + i * 18, 204, 10),
                                PBEmpty, ScaleMode.ScaleAndCrop);
                GUI.DrawTextureWithTexCoords(new Rect(571, offset + i * 18,
                                                      204 * selectedChar.CurrentHP / totalHP, 10), PBFull,
                                             new Rect(0, 0, selectedChar.CurrentHP / totalHP, 1));
                offset += 10;
                GUI.Label(new Rect(571, offset + i * 18, 150, 23),
                          "Experience");
                GUI.Label(new Rect(715, offset + i * 18, 58, 23),
                          selectedChar.Exp.ToString() + "/" +
                          selectedChar.nextLevelExp.ToString(), "AttrValues");
                offset += 23;
                GUI.DrawTexture(new Rect(571, offset + i * 18, 204, 10),
                                PBEmpty, ScaleMode.ScaleAndCrop);
                offset -= 3;
            }
            else
            {
                GUI.Label(new Rect(715, offset + i * 18, 58, 23),
                          secAttr.Value.ToString(), "AttrValues");
            }
        }
    }