Last active
November 4, 2022 08:20
-
-
Save daniele-quero/73bdf6c8a53f6138a39bc4ab5730f1fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public HorseState GetCurrentState() | |
{ | |
bool parsed = false; | |
HorseState currentState; | |
foreach (string name in Enum.GetNames(typeof(HorseState))) | |
{ | |
if (_animator.GetCurrentAnimatorStateInfo(0).IsName(name)) | |
{ | |
parsed = Enum.TryParse<HorseState>(name, out currentState); | |
if (parsed) | |
return currentState; | |
} | |
} | |
return HorseState.none; | |
} | |
public void Play(string trigger) | |
{ | |
_animator.SetTrigger(trigger); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment