private void OnValidate() { floatVariables = new Dictionary <string, float>(); foreach (string var in editorFloatVariables) { floatVariables.Add(var, 0); } boolVariables = new Dictionary <string, bool>(); foreach (string var in editorBoolVariables) { boolVariables.Add(var, false); } states = new Dictionary <string, SSAStateBody>(); for (int i = 0; i < editorStates.Length; i++) { states.Add(editorStates[i].name, editorStates[i]); states[editorStates[i].name].Inject(this); if (editorStates[i].defaultState) { defaultState = editorStates[i]; currentState = editorStates[i]; animator.SetAnimation(currentState.anim); } } }
public void TransitionTo(string stateName) { currentState = states[stateName]; currentState.Enter(); }