示例#1
0
        private void EvaluateState(FlashLightState state)
        {
            switch (state)
            {
            case FlashLightState.On:
                Console.WriteLine("Flashlight is On");
                break;

            case FlashLightState.Off:
                Console.WriteLine("Flashlight is Off");
                break;
            }
        }
示例#2
0
        public void HandleEvent(FlashLightEvent evt)
        {
            switch (_currentState)
            {
                case FlashLightState.On:
                    _currentState = FlashLightState.Off;
                    Off();
                    break;

                case FlashLightState.Off:
                    _currentState = FlashLightState.On;
                    On();
                    break;
            }
        }
示例#3
0
        public void HandleEvent(FlashLightEvent evt)
        {
            switch (_currentState)
            {
            case FlashLightState.On:
                _currentState = FlashLightState.Off;
                Off();
                break;

            case FlashLightState.Off:
                _currentState = FlashLightState.On;
                On();
                break;
            }
        }
        public void HandleEvent(FlashLightEvent evt)
        {
            switch (_currentState)
            {
            case FlashLightState.On:
                _currentState = FlashLightState.Off;
                Console.WriteLine("Flaslight off");
                break;

            case FlashLightState.Off:
                _currentState = FlashLightState.On;
                Console.WriteLine("Flaslight on");
                break;
            }
        }
示例#5
0
        public void HandleEvent(FlashLightEvent evt)
        {
            while (true)
            {
                switch (_currentState)
                {
                case FlashLightState.On:
                    _currentState = FlashLightState.Off;
                    Console.WriteLine("Turned off");
                    Thread.Sleep(500);
                    break;

                case FlashLightState.Off:
                    _currentState = FlashLightState.On;
                    Console.WriteLine("Turned On");
                    Thread.Sleep(500);
                    break;
                }
            }
        }
示例#6
0
 public void SetState(FlashLightState state)
 {
     if (m_flashState == FlashLightState.OFF)
     {
         // enable flashLight
         if (SingletonManager.Player.GetComponent <PlayerBattery>().HasBattery())
         {
             // m_light.range = m_range;
             m_flashState = FlashLightState.ON;
             SingletonManager.AudioManager.Play(AudioType.FLASHLIGHT_ON);
             m_lightOne.enabled = true;
             m_light.enabled    = true;
         }
     }
     else
     {
         // disable flashLight
         // m_light.range = 0;
         m_flashState = FlashLightState.OFF;
         SingletonManager.AudioManager.Play(AudioType.FLASHLIGHT_OFF);
         m_lightOne.enabled = false;
         m_light.enabled    = false;
     }
 }
示例#7
0
 public Flashlight()
 {
     _currentState = FlashLightState.Off;
     Off();
 }
 public FlashLight()
 {
     _currentState = FlashLightState.Off;
 }
示例#9
0
 public Flashlight()
 {
     _currentState = FlashLightState.Off;
     Off();
 }
示例#10
0
 public void SetFlashLightState(FlashLightState state)
 {
     _state = state;
 }