State Categories can be thought of as folders for states. State Categories are used for a number of reasons:
To organize similar states into categories
To allow multiple states to be set at the same time (if not sharing variables between states)
To create multiple state types for more expressive code (if not sharing variables between states)
To enable including and excluding particular variables from assignment
State categories will appear as folders in the tree view, and can contain any number of States.
Note that categorized cannot be added inside of other categories.
To add a state category:
Expand a Screen or Entity that you want to add a category to
Right-click on the States item
Select Add State Category
Enter the name for the new category. By convention, categories should have the suffix "Category"
Click OK
By default a category categories do not set any variables. Any variable that should be set by the category must be explicitly added.
To exclude or exclude variables, click the ... button in the State Data tab and use the << and >> buttons to include and exclude variables.
Excluding variables has two benefits:
Simplifies the grid so only relevant variables are displayed
Removes unnecessary assignment of variables when a state is set
StateData is the concept of treating states similar to CSV data. FlatRedBall supports treating States as CSV data by providing a CSV-like interface when selecting a category, as shown in the following image:
For an in-depth discussion of State Data, including how to exclude variables from inclusion, see the State Data blog post.