- Home /
Skill Behaviours Implementation
At the moment I have a dilemma about the skill system architecture and the skill behavior implementation. I have a base class Skill
public class Skill
{
private string skillName;
private int skillIndex;
private int skillDamage;
private string skillDescription;
private int skillCoolDown;
public Sprite skillIcon;
public GameObject skillSlot;
public string SkillName {get;set;}
public int SkillIndex{get;set;}
public int SkillDamage {get;set;}
public string SkillDescription {get;set;}
public int SkillCoolDown {get;set;}
public Skill (){
}
public Skill (int SkillIndex){
}
}
and classes that inherit from Skill class.
public class BasicAttack:Skill
{
public BasicAttack()
{
SkillIndex = 1;
SkillCoolDown = 2;
}
}
What is the best way to implement the skill behaviors for each skill in my case? At first, I thought to make a Skills_Behaviors:Monobehaviour class and implement the behaviours for all the skills there and simply drop it to the Player GameObject. But most of the skills need its own Start() and Update() methods. Then if I will make SkillBehaviour class for each skill, does it mean that I have to apply all of this scripts to the GameObjects, and is it a good practice? And the final thought was to make the Skill class inherit from Monobehaviour, and implement the behaviours in the base classes. But this also feels wrong to me.
Here is my Basic_Attack behaviour example:
public void BasicAttackSkill()
{
Instantiate(Bullet, firepoint.position, Quaternion.identity);
}