示例#1
0
 private void SetState(LightState newState)
 {
     _spriteComponent.LayerSetVisible(1, newState == LightState.On);
     _pointLight.State = newState;
     if (_clothingComponent != null)
     {
         _clothingComponent.ClothingEquippedPrefix = newState.ToString();
     }
 }
        public static string NiceString(this LightState state)
        {
            switch (state)
            {
            case LightState.RedYellow:
                return("Red, Yellow");

            case LightState.Unknown:
                return("Yellow blink");

            default:
                return(state.ToString());
            }
        }
示例#3
0
        private void ChangeState(LightState newState)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Changing state from ");
            sb.Append(CurrentState.ToString());
            sb.Append(" to ");
            sb.Append(newState.ToString());
            sb.Append(Environment.NewLine);

            _logger.Log(sb.ToString());

            CurrentState = newState;
        }
示例#4
0
        public void ToStringShouldReturnFormattedProperties()
        {
            var state = new LightState(Label.None, Power.Off, Percentage.MaxValue, Temperature.None, Color.None);

            state.ToString().Should().Be(
                string.Format(
                    "[Label: {0}; Power: {1}; Brightness: {2}; Temperature: {3}; Color: {4}]",
                    state.Label,
                    state.Power,
                    state.Brightness,
                    state.Temperature,
                    state.Color
                    )
                );
        }