예제 #1
0
    void OnGUI()
    {
        if (showTree)
        {
            for (int i = 0; i < listOfSkills.Count; i++)
            {
                MySkill skill = listOfSkills[i];
                if (skill.isActive)
                {
                    GUI.color = skill.btnOn;
                }
                else
                {
                    GUI.color = skill.btnOff;
                }

                if (GUI.Button(skill.position, skill.label))
                {
                    if (skill.isAvailable() && (ps.skillPoint >= skill.skillCost) && !skill.isActive)
                    {
                        ps.skillPoint -= skill.skillCost;
                        ps.changePlayerStat(skill.statToChange, skill.statValue);
                        skill.isActive = true;
                    }
                }
            }
        }
    }
예제 #2
0
    void Start()
    {
        ps           = gameObject.GetComponent <Player> ();
        showTree     = false;
        listOfSkills = new List <MySkill>();

        MySkill HP1 = new MySkill("HP I", 1, "maxHealth", 6);
        MySkill HP2 = new MySkill("HP II", 2, "maxHealth", 7);
        MySkill HP3 = new MySkill("HP III", 3, "maxHealth", 8);

        HP2.addRequirement(HP1);
        HP3.addRequirement(HP2);
        listOfSkills.Add(HP1);
        listOfSkills.Add(HP2);
        listOfSkills.Add(HP3);
    }
예제 #3
0
 public void addRequirement(MySkill skill)
 {
     requirements.Add(skill);
 }
예제 #4
0
 void AddMySkill(MySkill mySkill)
 {
     skillList.Add(mySkill);
 }