Lets say we have 2 Characters and 1 Base Character.
The Base Character have the basic script so he can just walk and jump.
The 1º Character in adition to walk and jump he can double jump.
The 2º Character is adition to walk, jump and double jump he can run.
How i am planning to do that:
Make the Base Character script.
Make a script for each aditional skill that add its effect to the Base Character script when attached to the same object.
Its that possible in Javascript? Or i should just get a boolean to check if every character have some skill?
There’s not really any easy way to do this. One way this could be implemented would be for the first script to look and see if the other script are attached to the gameObject. Another way would OOP and extend the base scripts class.
For what you’re trying to do, I would recommend you just have a few boolean varibles in the base script that say canDoubleJump, or canRun. This would be a lot easier to implement, simpler, and probably faster.
They can be in different files. All your scripts by default extend MonoBehaviour, so you’re doing it from different files all the time without realizing it.