Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2012
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Lightswitch : UsableEntity
  5. {
  6.     public Light targetLight;
  7.  
  8.     public override string Action { get { return "Activate"; } }
  9.  
  10.     public override void OnUse()
  11.     {
  12.         if(targetLight == null)
  13.             return;
  14.  
  15.         targetLight.enabled = !targetLight.enabled;
  16.         StartCoroutine(OnSwitch());
  17.     }
  18.  
  19.     private IEnumerator OnSwitch()
  20.     {
  21.         State = UsableState.Disabled;
  22.         yield return new WaitForSeconds(3);
  23.         State = UsableState.Enabled;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement