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