public static UIState Diff(UIState fromState, UIState toState) { List <ColorState> colors = new List <ColorState>(); foreach (ColorState fromColor in fromState.ColorStates) { foreach (ColorState toColor in toState.ColorStates) { if (fromColor.Component == toColor.Component && fromColor.Color != toColor.Color) { colors.Add(toColor); } } } return(new UIState(colors)); }
protected void TransitionToState(UIState state) { _currentState = state; _colorTransitions.Clear(); _lerp = 0f; foreach (ColorState colorState in state.ColorStates) { _colorTransitions.Add(new ColorTransition( colorState.Component, colorState.Component.color, colorState.Color, colorState.Alpha)); } if (!_isAnimating) { _isAnimating = true; } }
public void OnPointerExit(PointerEventData eventData) { TransitionToState(UIState.Merge(_defaultState)); }
public void OnPointerEnter(PointerEventData eventData) { TransitionToState(UIState.Merge(_hoverState)); }