39 lines
905 B
C#
39 lines
905 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using AsyncStateMachine;
|
|
|
|
|
|
namespace ServerCore;
|
|
|
|
public static class HFSMHelper
|
|
{
|
|
public static bool isChangedState<TTrigger, TState>(this Transition<TTrigger, TState> transition)
|
|
where TTrigger : struct
|
|
where TState : struct
|
|
{
|
|
if(null == transition)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if(true == transition.Source.Equals(transition.Destination))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static string toBasicString<TTrigger, TState>(this Transition<TTrigger, TState> transition)
|
|
where TTrigger : struct
|
|
where TState : struct
|
|
{
|
|
return $"Transition: from:{transition.Source} => to:{transition.Destination} - Trigger:{transition.Trigger.ToString()}";
|
|
}
|
|
}
|