Example #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;
            }
        }
Example #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;
            }
        }
Example #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;
            }
        }
Example #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;
                }
            }
        }
Example #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;
     }
 }
Example #7
0
 public Flashlight()
 {
     _currentState = FlashLightState.Off;
     Off();
 }
 public FlashLight()
 {
     _currentState = FlashLightState.Off;
 }
Example #9
0
 public Flashlight()
 {
     _currentState = FlashLightState.Off;
     Off();
 }
Example #10
0
 public void SetFlashLightState(FlashLightState state)
 {
     _state = state;
 }