public void SetState(string value) { if (State != null && !CurrentState.HasEnded) { States[State].EndState(); } State = value; CurrentState.BeginState(); }
/// <summary> /// Sets Stand's AI state to the one with the provided key /// </summary> /// <param name="state">State key</param> /// <param name="animationKey">Animation key <para>If no animation key is provided, will look for animation with the same key as state.</para><para>In case no key is found, does not switch the animation</para></param> public void SetState(string state, string animationKey = "None") { if (State == state) { return; } if (animationKey == "None") { if (Animations.ContainsKey(state)) { CurrentAnimation = state; } } else { CurrentAnimation = animationKey; } State = state; CurrentState.BeginState(); }