Skill
π― Skill Class
Skill data container.
Namespace:
Esper.SkillWeb
Inherits from:SkillWebObject
Type:class
π¦ Fields
public
skillName
string
The searchable name of the skill.
public
maxLevel
int
The max skill level.
public
levelRequirement
int
The level the player must reach to be able to unlock this skill.
public
tagIndex
int
The tag index.
public
lockedIcon
SkillIcon
The icon to display when the skill is locked.
public
unlockedIcon
SkillIcon
The icon to disply when the skill is unlocked.
public
obtainedIcon
SkillIcon
The icon to display when the skill is obtained.
public
maxedIcon
SkillIcon
The icon to display when the skill is maxed.
public
size
Size
The size of the skill in the UI.
public
demoClip
VideoClip
A video clip that demonstrates the skill.
public
dataset
SkillDataset
The dataset.
public static
resourcesPath
string
The path to all generated objects of this type relative to the resources folder.
π Properties
public
Tag
string
The skill tag.
public
DatabaseRecord
SkillRecord
The database record.
π§° Methods
public
GetIcon(State, bool)
SkillIcon
Gets an icon for a specific state.
public
GenerateDataset()
void
Generates the dataset with the dataset reference set from Skill Web's settings (editor only).
public static
Create()
Skill
Creates a new instance of a skill (editor only).
public
UpdateAssetName()
void
Updates the name of the asset (editor only).
public override
Save()
void
Saves the skill asset.
protected override
GetID<T>(string)
int
Gets a unique ID for the skill.
π§© Nested Structs
public struct SkillIcon
Represents a skill icon.
public
icon
Sprite
The icon.
public
color
Color
The color tint of the icon.
π§© Nested Enums
public enum State
The state of a skill.
Locked
Currently unobtainable. A skill is unobtainable if the level or connection requirement is not met.
Unlocked
The skill can be obtained.
Obtained
The skill has been obtained.
Maxed
The skill's level has been maxed.
public enum Size
The size of a skill.
Tiny
Tiny size.
Small
Small size.
Medium
Medium size.
Large
Large size.
Giant
Giant size.
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