// Start is called before the first frame update void Start() { Sound = GameObject.Find("SoundManager").GetComponent <TestSound>(); cam = GameObject.Find("Main Camera").GetComponent <CameraShake>(); ui = GameObject.Find("Canvas").GetComponent <UIManager>(); manager = GameObject.Find("GameManager").GetComponent <GameManager>(); }
void Awake() { //PlayerPrefs.DeleteAll (); DontDestroyOnLoad(this.gameObject); if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
// Start is called before the first frame update void Start() { Sound = GameObject.Find("SoundManager").GetComponent <TestSound>(); if (PlayerPrefs.GetInt("Music") == 0) { MusicOn.GetComponent <Button>().interactable = false; MusicOff.GetComponent <Button>().interactable = true; Sound.UnMuteMusic("Background"); } else if (PlayerPrefs.GetInt("Music") == 1) { MusicOn.GetComponent <Button>().interactable = true; MusicOff.GetComponent <Button>().interactable = false; Sound.MuteMusic("Background"); } if (PlayerPrefs.GetInt("Sound") == 0) { SoundOn.GetComponent <Button>().interactable = false; SoundOff.GetComponent <Button>().interactable = true; Sound.UnMuteMusic("1"); Sound.UnMuteMusic("Buzz3"); Sound.UnMuteMusic("Diamond"); PlayerPrefs.SetInt("Sound", 0); } else if (PlayerPrefs.GetInt("Sound") == 1) { SoundOn.GetComponent <Button>().interactable = true; SoundOff.GetComponent <Button>().interactable = false; Sound.MuteMusic("1"); Sound.MuteMusic("Buzz3"); Sound.MuteMusic("Diamond"); } CurrentScene = SceneManager.GetActiveScene(); if (CurrentScene.name == "MainMenu") { ShopDiamonds.text = PlayerPrefs.GetInt("Diamonds").ToString(); MainDiamonds.text = PlayerPrefs.GetInt("Diamonds").ToString(); HighScore.text = PlayerPrefs.GetInt("HighScore").ToString(); } else { manager = GameObject.Find("GameManager").GetComponent <GameManager>(); int back = Random.Range(0, Backgrounds.Length); background.GetComponent <Image>().sprite = Backgrounds[back]; } }
public void Fire(string name) { Sound = GameObject.Find("SoundManager").GetComponent <TestSound>(); if (GameManager.gameOn) { Sound.PlaySounds("1"); if (name == "0") { GameObject obj = Instantiate(level.Neon[PlayerPrefs.GetInt("NeonNumber")].Fire[0], new Vector3(1.92f, 3.98f, 0), Quaternion.identity); obj.name = "Blue"; obj.transform.SetParent(GameObject.Find("Fire").transform); } else if (name == "1") { GameObject obj = Instantiate(level.Neon[PlayerPrefs.GetInt("NeonNumber")].Fire[1], new Vector3(1.92f, 2.02f, 0), Quaternion.identity); obj.name = "White"; obj.transform.SetParent(GameObject.Find("Fire").transform); } else if (name == "2") { GameObject obj = Instantiate(level.Neon[PlayerPrefs.GetInt("NeonNumber")].Fire[2], new Vector3(1.92f, -0.52f, 0), Quaternion.identity); obj.name = "Green"; obj.transform.SetParent(GameObject.Find("Fire").transform); } else if (name == "3") { GameObject obj = Instantiate(level.Neon[PlayerPrefs.GetInt("NeonNumber")].Fire[3], new Vector3(-1.92f, 3.98f, 0), Quaternion.identity); obj.name = "Purple"; obj.transform.SetParent(GameObject.Find("Fire").transform); } else if (name == "4") { GameObject obj = Instantiate(level.Neon[PlayerPrefs.GetInt("NeonNumber")].Fire[4], new Vector3(-1.92f, 2.02f, 0), Quaternion.identity); obj.name = "Pink"; obj.transform.SetParent(GameObject.Find("Fire").transform); } else if (name == "5") { GameObject obj = Instantiate(level.Neon[PlayerPrefs.GetInt("NeonNumber")].Fire[5], new Vector3(-1.92f, -0.52f, 0), Quaternion.identity); obj.name = "Orange"; obj.transform.SetParent(GameObject.Find("Fire").transform); } } }
void Awake() { //PlayerPrefs.DeleteAll (); DontDestroyOnLoad(gameObject); if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } Sounds obj = new Sounds(); for (int i = 0; i < sounds.Length; i++) { GameObject Soundsclips = new GameObject("Sounds" + i + "" + sounds[i].Clipname); Soundsclips.transform.SetParent(this.transform); sounds[i].SetSource(Soundsclips.AddComponent <AudioSource>()); } }
private void Awake() { Sound = GameObject.Find("SoundManager").GetComponent <TestSound>(); }
private void Awake() { I = this; }