void StartAnimation(string startState, string endState) { isAnimationActive = false; animationStartState = StateItem.GetStateId(startState); animationEndState = StateItem.GetStateId(endState); animationCurrentDuration = 0; animationCurrentStartDelay = animationStartDelay; isAnimationActive = true; }
/* * Func: SetAnimationStateRectTransform (state, rectTransform) * Sets all <RectTransform at http://docs.unity3d.com/ScriptReference/RectTransform.html> related fields in <AnimationStates> for specified state * * If rectTransform parameter is not defined, the <RectTransform at http://docs.unity3d.com/ScriptReference/RectTransform.html> of current game object will be used. * * Parameters: * state - state name to fill <RectTransform at http://docs.unity3d.com/ScriptReference/RectTransform.html> fields in <AnimationStates> * rectTransform - object to gather <RectTransform at http://docs.unity3d.com/ScriptReference/RectTransform.html> fields from */ public void SetAnimationStateRectTransform(string state, RectTransform rectTransform = null) { if (rectTransform == null) { rectTransform = rectRransform; } int stateId = StateItem.GetStateId(state); if (stateId < 0) { return; // no state found } animationStates[stateId].RectTransform_offsetMin = rectTransform.offsetMin; animationStates[stateId].RectTransform_offsetMax = rectTransform.offsetMax; animationStates[stateId].RectTransform_anchorMin = rectTransform.anchorMin; animationStates[stateId].RectTransform_anchorMax = rectTransform.anchorMax; }