top of page
Search

Drop and Drag State Machine

Updated: Jul 8, 2022



Description

Drag and Drop Finite State Machine where the game designer can switch between different states and its state transitions with out having to code.


Following Features

  • Easy to add and remove states in the inspector.

  • Quick drag and drop state transitions.

  • Fast way to make new states with state template .

  • Bool Data to access state transitions from outside the script.

Installation


Github:


Package Manager

Install via Git URL

Open Window/Package Manager, and package from git URL...

https://github.com/MarquisMc/StateMachine.git

How to use

1. Add NewestStateMachine Component











2. Create a new state


Every State Script Needs

  • To inherit from StateExtension

  • A BoolData to determine when the state can transition

  • A state transition function

Example

// every state script must be a subclass of StateExtension
public class StateTemplate : StateExtension
{
    // every state has a BoolData to determine if the state can transition
    public BoolData boolData;
    public bool somethingHappened;

    // every state should have a State Transition function
    void StateTransition() 
    {
        if (somethingHappened == true && boolData.GetData() == false)
        {
            boolData.SetData(true);
        }
    }

    private void Update() 
    {
        StateTransition();
    }
}

3. Add and set up states


Add State






Set up state












4. Set up state transitions














5. BoolData





Live Example

Transitioning between states












Support

Need support or have ideas for new features for this tool contact me at


License

6 views0 comments

Recent Posts

See All

Kommentarer


Post: Blog2_Post
bottom of page