示例#1
0
        public SkillButton(Transform transform, PlayerSkills playerSkills, PlayerSkills.SkillType skillType, Material skillLockedMaterial, Material skillUnlockableMaterial)
        {
            this.transform               = transform;
            this.playerSkills            = playerSkills;
            this.skillType               = skillType;
            this.skillLockedMaterial     = skillLockedMaterial;
            this.skillUnlockableMaterial = skillUnlockableMaterial;

            image           = transform.Find("image").GetComponent <Image>();
            backgroundImage = transform.Find("background").GetComponent <Image>();

            transform.GetComponent <Button_UI>().ClickFunc = () => {
                if (!playerSkills.IsSkillUnlocked(skillType))
                {
                    // Skill not yet unlocked
                    if (!playerSkills.TryUnlockSkill(skillType))
                    {
                        Tooltip_Warning.ShowTooltip_Static("Cannot unlock " + skillType + "!");
                    }
                }
            };
        }
示例#2
0
        public SkillButton(Transform transform, PlayerSkills playerSkills, PlayerSkills.SkillType skillType, Material skillLockedMaterial, Material skillUnlockableMaterial, string description)
        {
            this.transform               = transform;
            this.playerSkills            = playerSkills;
            this.skillType               = skillType;
            this.description             = description;
            this.skillLockedMaterial     = skillLockedMaterial;
            this.skillUnlockableMaterial = skillUnlockableMaterial;

            image           = transform.Find("Image").GetComponent <Image>();
            backgroundImage = transform.Find("background").GetComponent <Image>();
            transform.GetComponent <Button_UI>().MouseOverOnceFunc = () => Tooltip.ShowTooltip_Static(description);
            transform.GetComponent <Button_UI>().MouseOutOnceFunc  = () => Tooltip.HideTooltip_Static();

            transform.GetComponent <Button_UI>().ClickFunc = () =>
            {
                if (!playerSkills.TryUnlockingSkill(skillType))
                {
                    //place for the warning box initiation
                }
            };
        }