Пример #1
0
 public void Setup()
 {
     mockLightActuator     = new Mock <ILightActuator>();
     mockObserver          = new Mock <IObserver>();
     lightContext          = new LightContext(mockLightActuator.Object);
     lightContext.Observer = mockObserver.Object;
 }
Пример #2
0
 public Light()
 {
     this.lightActuator    = new LightActuator();
     this.context          = new LightContext(lightActuator);
     this.context.Observer = ObserverConsole.Instance;
     this.context.EnterInitialState();
 }
Пример #3
0
 public void Setup()
 {
     repository            = new MockRepository();
     lightActuator         = repository.StrictMock <ILightActuator>();
     observer              = repository.StrictMock <IObserver>();
     lightContext          = new LightContext(lightActuator);
     lightContext.Observer = observer;
 }
Пример #4
0
        /// <summary>
        /// 状态模式--灯
        /// </summary>
        static void TestLightState()
        {
            LightContext context = new LightContext(new LightOff());

            context.PressSwitch();
            context.PressSwitch();
            context.PressSwitch();
            context.PressSwitch();
        }
Пример #5
0
 public LightSource(int textureIndex, Vector2 position, float radius, LightContext light_context = LightContext.None, long playerID = 0L)
     : this()
 {
     this.textureIndex.Value = textureIndex;
     this.position.Value     = position;
     this.radius.Value       = radius;
     color.Value             = Color.Black;
     lightContext.Value      = light_context;
     this.playerID.Value     = playerID;
 }
Пример #6
0
 public LightsController(LightContext context)
 {
     _context = context;
 }
Пример #7
0
 public LightSource(int textureIndex, Vector2 position, float radius, Color color, int identifier, LightContext light_context = LightContext.None, long playerID = 0L)
     : this()
 {
     this.textureIndex.Value = textureIndex;
     this.position.Value     = position;
     this.radius.Value       = radius;
     this.color.Value        = color;
     this.identifier.Value   = identifier;
     lightContext.Value      = light_context;
     this.playerID.Value     = playerID;
 }