Search Unity

Question How to make player state(?)

Discussion in 'Scripting' started by whtkrl, Jan 9, 2023.

  1. whtkrl

    whtkrl

    Joined:
    Jan 9, 2023
    Posts:
    3
    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
    1. Implemented by switching the state using fsm.
    2. 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
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,674
    You could do any of this any one of ten million different ways.

    Work through two or three small tutorials on RPG games to understand how they do it.
     
  3. dlorre

    dlorre

    Joined:
    Apr 12, 2020
    Posts:
    699
    The biggest issue is whether you have only 1 state at a time, or if they can stack. For example if you are playing then open the UI for a dialog box then open a new scene with parameters and then another dialog box, if these are represented by states then you will have to unstack everything and return to the player once you close all the UI items. As for the implementation, maybe consider firing events at the beginning and at the end of each state.