Guest User

Untitled

a guest
Aug 15th, 2015
57
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 on : MonoBehaviour {
  5.     public AudioClip soundOn;  
  6.    
  7.    
  8.     // Update is called once per frame
  9.     void Update () {
  10.         if(Input.GetKeyDown (KeyCode.Mouse1))
  11.         {
  12.             if(GetComponent<Light>().enabled == false)
  13.             {
  14.                 GetComponent<Light>().enabled = true;
  15.                 GetComponent<AudioSource>().Play();
  16.             }
  17.             else
  18.             {
  19.                 GetComponent<Light>().enabled = false;
  20.                 GetComponent<AudioSource>().Play();
  21.             }
  22.         }
  23.     }
  24. }
RAW Paste Data