Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question How to make player state(?)

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

  1. whtkrl


    Jan 9, 2023
    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


    Mar 16, 2013
    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


    Apr 12, 2020
    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.