Пример #1
0
 public void Dispose()
 {
     Object.Destroy(_view.gameObject);
     _rulesAndViews.Clear();
     _currentState  = null;
     _previousState = null;
 }
Пример #2
0
        private void ChangeState(LightColorRulesConfig newState, LightTransitionConfig transition = null)
        {
            foreach (var t in _view.Lights)
            {
                t.TurnOff();
            }

            if (transition != null && !transition.SwitchOffCurrentStateOnEnter)
            {
                _rulesAndViews[_currentState].TurnOn();
            }

            _rulesAndViews[newState].TurnOn();
            _previousState = _currentState;
            _currentState  = newState;
        }