From 4e6b8f4d69c6ad29c53ff9f9a2cd240e05da4524 Mon Sep 17 00:00:00 2001 From: Ye Feng Date: Wed, 14 Dec 2016 15:27:44 +1300 Subject: [PATCH 1/2] Fix state name cannot contains underscore issue --- .../Assets/MonsterLove/StateMachine/StateMachine.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/example_project/Assets/MonsterLove/StateMachine/StateMachine.cs b/example_project/Assets/MonsterLove/StateMachine/StateMachine.cs index 832cd77..1334d03 100644 --- a/example_project/Assets/MonsterLove/StateMachine/StateMachine.cs +++ b/example_project/Assets/MonsterLove/StateMachine/StateMachine.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Made With Monster Love (Pty) Ltd + * Copyright (c) 2016 Made With Mosnter Love (Pty) Ltd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -102,10 +102,13 @@ public StateMachine(StateMachineRunner engine, MonoBehaviour component) continue; } + var stateName = string.Join("_", names, 0, names.Length - 1); + var eventName = names[names.Length - 1]; + Enum key; try { - key = (Enum) Enum.Parse(typeof(T), names[0]); + key = (Enum) Enum.Parse(typeof(T), stateName); } catch (ArgumentException) { @@ -115,7 +118,7 @@ public StateMachine(StateMachineRunner engine, MonoBehaviour component) var targetState = stateLookup[key]; - switch (names[1]) + switch(eventName) { case "Enter": if (methods[i].ReturnType == typeof(IEnumerator)) From d895bac4c413e111e411e1234f1b9be7d85c6bcd Mon Sep 17 00:00:00 2001 From: Peter Cardwell-Gardner Date: Thu, 9 Nov 2017 14:44:31 +0000 Subject: [PATCH 2/2] Update StateMachine.cs FIxed upstream spelling error --- example_project/Assets/MonsterLove/StateMachine/StateMachine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_project/Assets/MonsterLove/StateMachine/StateMachine.cs b/example_project/Assets/MonsterLove/StateMachine/StateMachine.cs index 1334d03..aca0e76 100644 --- a/example_project/Assets/MonsterLove/StateMachine/StateMachine.cs +++ b/example_project/Assets/MonsterLove/StateMachine/StateMachine.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Made With Mosnter Love (Pty) Ltd + * Copyright (c) 2016 Made With Monster Love (Pty) Ltd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to