void Awake() { if (instance == null) { instance = this; } soundObject = GameObject.Find("BackgroundMusic"); audioSource = soundObject.GetComponent <AudioSource>(); }
public void Initialization(int x_axis, int z_axis, Maze maze, BackgroundMusicController _musicController) { sizeZ = z_axis; sizeX = x_axis; mazeInstance = maze; musicController = _musicController; openDooreffect = this.GetComponent <AudioSource>(); openDooreffect.PlayOneShot(openTheDoorClip); isBossDead = false; }
// Use this for initialization void Start() { loginQuickReq = new LoginDataQuickReq(); ConnectionManager.GetInstance().Connect(delegate(bool isSuc) { if (isSuc) { } }); BackgroundMusicController.PlayMusic(6); }
// Use this for initialization void Awake() { Current = this; _bgMusicSource = gameObject.AddComponent <AudioSource>(); _bgMusicSource.clip = BgMusic; _bgMusicSource.loop = true; if (SoundManager.Instance.IsMusicOn()) { _bgMusicSource.Play(); } }
// Use this for initialization void Start() { if (instance == null) { DontDestroyOnLoad(this.gameObject); instance = this; } else { Destroy(this.gameObject); } }
private void Awake() { if (Instance != null) { Destroy(gameObject); } else { Instance = this; DontDestroyOnLoad(gameObject); } }
// private void CreateTrashes(Switch sw){ // int randSeed = Random.Range(0,3); // Trash m_trash = Instantiate(trash_type_list[ randSeed ]) as Trash; // m_trash.transform.position = sw.transform.position; // trash_instance_list.Add(m_trash); // } // public void DestoryTrash(){ // foreach(Trash trash in trash_instance_list){ // Destroy(trash.gameObject); // } // } private void BeginGame() { // create maze instance from prefab switchCount = 0; mazeInstance = Instantiate(mazePrefab) as Maze; mazeInstance.sizeX = size; mazeInstance.sizeZ = size; mazeInstance.Generate(); playerInstance = Instantiate(playerPrefab) as Player; playerInstance.gameObject.name = "unitychan(Clone)"; musicContollerInstance = Instantiate(musicController) as BackgroundMusicController; }
private void Awake() { if (bgmc != null) { Destroy(gameObject); } else { bgmc = this; DontDestroyOnLoad(gameObject); } }
private void Awake() { if (!MakeSingleton()) { return; } SaveManager = GetComponent <SaveManager>(); MusicController = GetComponent <BackgroundMusicController>(); TransitionController = GetComponent <TransitionController>(); EquipmentManager = GetComponent <EquipmentManager>(); }
// Update is called once per frame void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); SceneManager.activeSceneChanged += DestroyOnMenuScreen; }
private void Awake() { Debug.Log("audio level is 1"); // First we check if there are any other instances conflicting if (instance != null) { // If that is the case, we destroy other instances Destroy(gameObject); //Debug.Log("destroyed instance of background music" + gameObject); } else if (instance == null) { // Here we save our singleton instance instance = this; //Debug.Log("instance saved as " + this); // Furthermore we make sure that we don't destroy between scenes (this is optional) DontDestroyOnLoad(gameObject); } }
// Use this for initialization void Awake() { m_bgMusicController = this; }
void Awake() { singleton = this; DontDestroyOnLoad(this); }
void Awake() { Instance = this; }
private void Awake() { instance = this; audio = GetComponent <AudioSource>(); FadeInBackgroundMusic(); }
void Awake() { singleton = this; DontDestroyOnLoad(this); }