Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Runtime/Internal/InnerStateData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

namespace GameLovers.StatechartMachine.Internal
{
internal struct InnerStateData
/// <summary>
/// This data objects contains the basic information about the current states managed by the statechart
/// </summary>
internal class InnerStateData
{
public IStateInternal InitialState;
public IStateInternal CurrenState;
Expand Down
4 changes: 3 additions & 1 deletion Runtime/Internal/StateFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

namespace GameLovers.StatechartMachine.Internal
{
/// <summary>
/// References of the data to be use in the <see cref="IStateFactory"/> to manage the pattern of state creation
/// </summary>
internal struct StateFactoryData
{
// TODO: Check if Action fields inside structs is a problem
public Action<IStatechartEvent> StateChartMoveNextCall;
public IStatechart Statechart;
}
Comment on lines 5 to 15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new hunk adds a summary comment to the StateFactoryData struct, which improves code readability and understanding. However, it's important to note that mutable structs with public fields, like StateFactoryData, can lead to unexpected behavior if not handled carefully. Consider encapsulating these fields with properties and making the struct immutable or changing it to a class if mutability is required.

-	internal struct StateFactoryData
- 	{
- 		public Action<IStatechartEvent> StateChartMoveNextCall;
- 		public IStatechart Statechart;
- 	}
+	internal class StateFactoryData
+ 	{
+ 		public Action<IStatechartEvent> StateChartMoveNextCall { get; set; }
+ 		public IStatechart Statechart { get; set; }
+ 	}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.gamelovers.statechart",
"displayName": "Statechart",
"author": "Miguel Tomas",
"version": "0.9.0",
"version": "0.9.1",
"unity": "2021.4",
"license": "MIT",
"description": "This package allows the use of Statecharts (Hierarchichal State Machine) within an Unity project.\n\nThe primary feature of Statecharts is that states can be organized in a hierarchy.\nA Statecharts is a state machine where each state in the state machine may define its own subordinate state machines, called substates.\nThose states can again define substates.\n\nFor more information: https://statecharts.github.io/what-is-a-statechart.html",
Expand Down