コード例 #1
0
        public void setup(string colors, string initialColor, string length)
        {
            var argumentParser = new ArgumentParser("ColorChanger");

            _initialState = new ColorChangerState {
                color = argumentParser.TryParse <ElementColor>(initialColor, Enum.TryParse)
            };
            _length = argumentParser.TryParse <float>(length, float.TryParse);

            foreach (var color in ParseHelper.parseEnumListFromString <ElementColor>(colors))
            {
                var eventInfo = elementInfo.getEventInfoBySearchTag("color_change_" + color.ToString().ToLower());
                effectorEvents.Add(new EffectorEvent(eventInfo.icon,
                                                     () => {
                    Elements.executeVisualChange(this, () => {
                        var savedColor      = color;
                        _currentState.color = savedColor;
                    });
                }));
            }
            gate.localPosition = new Vector3(0, _length / 2);
            gate.localScale    = new Vector3(gate.localScale.x, _length);

            _currentState = new ColorChangerState(_initialState);
            setVisualsByState(_currentState);
        }
コード例 #2
0
 public void reset()
 {
     _currentState = new ColorChangerState(_initialState);
 }
コード例 #3
0
 public ColorChangerState(ColorChangerState that)
 {
     color = that.color;
 }