Git Product home page Git Product logo

statemachine's Introduction

Drag and Drop StateMachine

Descripiton

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 the state template.
  • BoolData to access state transitions from outside the script.

Installation

Package Manager

Install via git url

Open Window/Package Manager, and add 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 detemind 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

BoolData

Bool data is a component that has a bool and a name attached in the editor and that can be easily accessed from anywhere in the code.

Live Example

Transitioning between states

Support

Need support or have ideas for new features for this tool Contact me at [email protected]

License

MIT

statemachine's People

Contributors

marquismc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.