protected void SetInitialState(UIState state) { foreach (ColorState colorState in state.ColorStates) { colorState.Component.color = UIColors.WithAlpha( (Color)colorState.Color, (float)colorState.Alpha); } _currentState = state; }
protected override void Start() { base.Start(); ColorSprite.color = UIColors.WithAlpha(_baseColor, _colorAlpha); BorderSprite.color = UIColors.WithAlpha(_accentColor, _borderAlpha); _defaultState = new List <ColorState> { new ColorState(ColorSprite, _baseColor, _colorAlpha), new ColorState(BorderSprite, _accentColor, _borderAlpha) }; _hoverState = new List <ColorState> { new ColorState(ColorSprite, _baseColor, _colorAlphaHover), new ColorState(BorderSprite, _accentColor, _borderAlphaHover) }; }