Hello I’m trying to make an action rpg game.
I’m trying to implement the enemy as a pluggable pattern.
I don’t know how to implement the player.
What I’m worried about
- Implemented by switching the state using fsm.
- Just create each script and attach it to the player character (move.cs , attack.cs … )
If you know of a better way, please let me know
You could maybe have one main player script and within that player script, you could have code that goes something like this:
public move moveScript;
public attack attackScript;
if (moveScript != null)
if (attackScript != null)
And then in each plugin script, you could either have a void or function that would replace Update OR you could just have update in it and it would work automatically. If you wanted each script to have a reference to the main script, and therefore, all of the player scripts, you could have script have a
public MainScript mainPlayerScript;
And in the Start() of the main script, do:
moveScript.mainPlayerScript = this;
attackScript.mainPlayerScript = this;
You could then do stuff like
attackSpeed = mainPlayerScript.moveScript.moveSpeed * 2;
Overall, your question is not very specific, and I might be misunderstanding you, but I hope it helps!