Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2012
150
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement