Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Intro_Scritping/Rhythm_Repeat_Fresh_Start/Assets/TheControlls.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
157 lines (122 sloc)
3.4 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System; | |
using System.Threading; | |
public class TheControlls : MonoBehaviour | |
{ | |
Ray ray; | |
RaycastHit hit; | |
public GameObject prefab; | |
public GameObject snare; | |
//Light Sources | |
public Light red1; | |
public Light red2; | |
public Light lime1; | |
public Light lime2; | |
public Light cyan1; | |
public Light cyan2; | |
public Light white1; | |
public Light white2; | |
public Light yellow1; | |
public Light yellow2; | |
//audio clips | |
public AudioClip snareDrum; | |
public AudioClip tomDrum; | |
public AudioClip baseDrum; | |
public AudioClip highhatDrum; | |
public AudioClip hangTomDrum; | |
//Audio Sources | |
public AudioSource snareSource; | |
public AudioSource tomSource; | |
public AudioSource baseSource; | |
public AudioSource highTomSource; | |
public AudioSource highHatSource; | |
//Extras | |
public GameObject leftCyllinder; | |
public GameObject rightCyllinder; | |
public Material baseLeft; | |
public Material baseRight; | |
public Material hitLeft; | |
public Material hitRight; | |
public bool playingback = false; | |
//Tracking Variables | |
public int playing = 0; | |
public int leftClicks = 0; | |
public int rightClicks = 0; | |
public int roundTracker = 0; | |
public int score = 0; | |
public int drumTrack = 0; | |
void Update () | |
{ | |
ray = Camera.main.ScreenPointToRay (Input.mousePosition); | |
//Clicking | |
// | |
if (Physics.Raycast (ray, out hit)) { | |
if (Input.GetKeyDown (KeyCode.Mouse0)) { | |
if (hit.transform.name == "Drum_Snare") | |
{ | |
Debug.Log("Left Mouse Down"); | |
gameObject.AddComponent<AudioSource>(); | |
gameObject.GetComponent<AudioSource>().clip = snareDrum; | |
gameObject.GetComponent<AudioSource>().Play(); | |
yellow1.enabled = !yellow1.enabled; | |
yellow2.enabled = !yellow2.enabled; | |
} | |
if (hit.transform.name == "Drum_Tom") | |
{ | |
Debug.Log("Left Mouse Down"); | |
gameObject.AddComponent<AudioSource>(); | |
gameObject.GetComponent<AudioSource>().clip = tomDrum; | |
gameObject.GetComponent<AudioSource>().Play(); | |
lime1.enabled = !lime1.enabled; | |
lime2.enabled = !lime2.enabled; | |
} | |
if (hit.transform.name == "Drum_Hanging_Tom") | |
{ | |
Debug.Log("Left Mouse Down"); | |
gameObject.AddComponent<AudioSource>(); | |
gameObject.GetComponent<AudioSource>().clip = hangTomDrum; | |
gameObject.GetComponent<AudioSource>().Play(); | |
cyan1.enabled = !cyan1.enabled; | |
cyan2.enabled = !cyan2.enabled; | |
} | |
if (hit.transform.name == "Drum_High_Hat") | |
{ | |
Debug.Log("Left Mouse Down"); | |
gameObject.AddComponent<AudioSource>(); | |
gameObject.GetComponent<AudioSource>().clip = highhatDrum; | |
gameObject.GetComponent<AudioSource>().Play(); | |
white1.enabled = !white1.enabled; | |
white2.enabled = !white2.enabled; | |
} | |
if (hit.transform.name == "Drum_Base") | |
{ | |
Debug.Log("Left Mouse Down"); | |
gameObject.AddComponent<AudioSource>(); | |
gameObject.GetComponent<AudioSource>().clip = baseDrum; | |
gameObject.GetComponent<AudioSource>().Play(); | |
red1.enabled = !red1.enabled; | |
red2.enabled = !red2.enabled; | |
} | |
if (hit.transform.name == "Drum_Tom") | |
{ | |
Debug.Log("Left Mouse Down"); | |
} | |
} | |
} | |
if (Input.GetKeyDown (KeyCode.Mouse1)) { | |
Debug.Log ("Righ Mouse Down"); | |
} | |
} | |
//Moving | |
// Use this for initialization | |
void Start() | |
{ | |
} | |
public void ClickStart() | |
{ | |
Debug.Log("Game Started!"); | |
playing = 1; | |
} | |
} |