Advertisement
MCA93

Sleep Interact Countdown

May 7th, 2023 (edited)
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | Gaming | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using FMODUnity;
  6.  
  7. public class Day6Sleep : MonoBehaviour
  8. {
  9.     [SerializeField] private GameObject _interactable;
  10.     [SerializeField] private int secondsToWait;
  11.     [SerializeField] private Light interactableLight;
  12.     [SerializeField] private StudioEventEmitter notification;
  13.    
  14.     private void Start()
  15.     {
  16.         StartSleepInteractCountdown();
  17.     }
  18.  
  19.     public void StartSleepInteractCountdown()
  20.     {
  21.         StopAllCoroutines();
  22.         StartCoroutine(SleepInteract());
  23.     }
  24.  
  25.     private IEnumerator SleepInteract()
  26.     {
  27.         yield return new WaitForSeconds(secondsToWait);
  28.         _interactable.SetActive(true);
  29.         interactableLight.enabled = true;
  30.         notification.Play();
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement