Exemplo n.º 1
0
        /// <summary>
        /// Unity event.
        /// </summary>
        private void Awake()
        {
            _data = GetComponent <FactoryRoomData>();

            _conveyorBeltAnimator = GetComponent <Animator>();
            _room         = GetComponent <KMGameplayRoom>();
            _audio        = GetComponent <KMAudio>();
            _gameCommands = GetComponent <KMGameCommands>();

            _room.OnLightChange += OnLightChange;
        }
Exemplo n.º 2
0
 private void Awake()
 {
     _data   = GetComponent <FactoryRoomData>();
     _scares = new Action[]
     {
         DoTorchLightScare,
         DoTorchLightScare,
         DoTorchLightScare,
         DoTorchLightScare,
         DoGlitchDistortScare,
         DoGlitchDistortScare,
         DoGlitchDistortScare,
         DoBump,
         DoBump,
         DoBump,
         DoBump,
         DoWibblyWobblyTime,
         DoWibblyWobblyTime,
         DoWibblyWobblyTime,
         DoFakeStrike,
         DoFakeNeedy,
     };
 }
Exemplo n.º 3
0
        private IEnumerator Flicker(FactoryRoomData data, float duration)
        {
            _audio.PlaySoundAtTransform(PowerOffSound.name, transform);
            data.EnableAmbient = data.EnableNormalLights = data.EnableWarningLights = false;
            _light.enabled     = false;

            _oldTVMaterial = data.TVDisplay.material;
            Material material = new Material(_oldTVMaterial);

            material.mainTexture    = TVBlack;
            data.TVDisplay.material = material;

            yield return(new WaitForSeconds(PowerOffDelay));

            _audio.PlaySoundAtTransform(SwitchSound.name, transform);
            _light.enabled = true;

            while (duration >= 0.0f)
            {
                yield return(new WaitForSeconds(0.1f));

                duration        -= 0.1f;
                _light.intensity = Mathf.MoveTowards(_light.intensity, Random.Range(0.0f, 1.0f), 0.05f);
            }

            _audio.PlaySoundAtTransform(PowerOnSound.name, transform);
            data.EnableAmbient = data.EnableNormalLights = data.EnableWarningLights = true;

            data.TVDisplay.material = _oldTVMaterial;

            yield return(new WaitForSeconds(PowerOnDelay));

            _audio.PlaySoundAtTransform(SwitchSound.name, transform);
            _light.enabled = false;

            gameObject.SetActive(false);
        }
Exemplo n.º 4
0
        public void DoFlicker(FactoryRoomData data, float duration)
        {
            gameObject.SetActive(true);

            StartCoroutine(Flicker(data, duration));
        }