Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class on : MonoBehaviour {
- public AudioClip soundOn;
- // Update is called once per frame
- void Update () {
- if(Input.GetKeyDown (KeyCode.Mouse1))
- {
- if(GetComponent<Light>().enabled == false)
- {
- GetComponent<Light>().enabled = true;
- GetComponent<AudioSource>().Play();
- }
- else
- {
- GetComponent<Light>().enabled = false;
- GetComponent<AudioSource>().Play();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement