Skill
The skill data class.
The Skill
class stores skill data. It gives an identity to a Skill Node. Skills are created through the Skill Bank.
Fields & Properties
skillName
The searchable name of the skill.
string
public
maxLevel
The max skill level.
int
public
levelRequirement
The level the player must reach to be able to unlock this skill.
int
public
tagIndex
The tag index.
int
public
lockedIcon
The icon to display when the skill is locked.
Skill.SkillIcon
public
unlockedIcon
The icon to disply when the skill is unlocked.
Skill.SkillIcon
public
obtainedIcon
The icon to display when the skill is obtained.
Skill.SkillIcon
public
maxedIcon
The icon to display when the skill is maxed.
Skill.SkillIcon
public
size
The size of the skill in the UI.
Skill.Size
public
demoClip
A video clip that demonstrates the skill.
VideoClip
public
dataset
The dataset.
SkillDataset
public
Tag
The skill tag.
string
public
SkillIcon
icon
The icon.
Sprite
public
color
The color tint of the icon.
Color
public
Creating a Skill
var skill = ScriptableObject.CreateInstance<Skill>();
Getting a Skill
You can get a skill with the SkillWeb.GetSkill
method by passing the ID or name of the skill as a parameter.
var mySkill = SkillWeb.GetSkill("My Skill");
To get all skills, use SkillWeb.GetAllSkills
. Note: this can be a lengthy task.
var allSkills = SkillWeb.GetAllSkills();
Custom Dataset
It's recommended to create a custom dataset for your skills. This allows you to set custom data for each skillâmaking customization easier.
Step 1: Inherit From SkillDataset
Create a new class and inherit from the SkillDataset
class.
using Esper.SkillWeb;
using UnityEngine;
public class MySkillDataset : SkillDataset
{
}
Optionally, you can inherit from DefaultSkillDataset
to use the default method of getting the skill name, description, and subtext.
Step 2: Create Asset Menu Option
SkillDataset
is a ScriptableObject
class, which means it can be added to the asset menu.
using Esper.SkillWeb;
using UnityEngine;
[CreateAssetMenu(fileName = "My Skill Dataset", menuName = "Skill Web/Datasets/My Skill Dataset")]
public class MySkillDataset : SkillDataset
{
}
Step 3: Override Methods
Override the required methods. These are used by the Skill Hovercard UGUI to get the texts, but how you use them is up to you.
using Esper.SkillWeb;
using UnityEngine;
[CreateAssetMenu(fileName = "My Skill Dataset", menuName = "Skill Web/Datasets/My Skill Dataset")]
public class MySkillDataset : SkillDataset
{
public override string GetDescription()
{
// Implement custom code here
return "";
}
public override string GetName()
{
// Implement custom code here
return "";
}
public override string GetSubtext()
{
// Implement custom code here
return "";
}
}
Step 4: Add Custom Fields
Add your custom fields. If they are serializable, they will be available for each skill in the Skill Bank.
using Esper.SkillWeb;
using UnityEngine;
[CreateAssetMenu(fileName = "My Skill Dataset", menuName = "Skill Web/Datasets/My Skill Dataset")]
public class MySkillDataset : SkillDataset
{
public float myCustomFloat;
public override string GetDescription()
{
// Implement custom code here
return "";
}
public override string GetName()
{
// Implement custom code here
return "";
}
public override string GetSubtext()
{
// Implement custom code here
return "";
}
}
Step 5: Set For All Skills
All you have left to do now is to create a new instance of your custom dataset from the asset menu and set it as the dataset reference for skills from Settings.
Last updated