J
J
justyork2014-02-16 10:50:34
C++ / C#
justyork, 2014-02-16 10:50:34

Unity3d. How to organize the skill system?

Hi everyone, please help me solve this problem. I have several classes:
1. BaseCharacter - here we describe general information about the player's name, his merits, and so on.
2. SkillController - here is the receipt of all possible skills for him, i.e. the ones he can use.
Actually, how can I properly organize the system of skills for the character, so that I can use the skill on a certain button, get its cd for the gui, i.e. for example, in SkillController, pass only the names or id of skills.
Now I just add the BaseCharacter component of the skills controller, and in it, the necessary skills. How to do it right?
Perhaps there is a much simpler option, but in skills I need to get the position of the character, and also use update for some skills.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Khlopianik, 2014-02-17
@justyork

The question is incorrect - you are almost asking to design the entire system.
As I would do (I took it from my head and did not check it in practice) - the base class for the Skill (it contains the main actions inherent in any skill (lifetime, activation by pressing a button, etc.)). Then for each skill - its own script, inherited from the base one. SkillController stores all skills under unique IDs (say, in a dictionary(ID, SkillBase)). You can take enum as an ID.

S
Sergey Sharkov, 2014-02-27
@Amfitorin

No not like this. When calling the constructor, we first call the constructor of the base Skill, where we send all the general data, and fill in the specific for this skill inside the constructor

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question