// Use this for initialization public void Start () { PauseController = GameObject.Find("PauseCanvas").GetComponent<PauseController>(); _timeAffected = GetComponent<TimeAffected> (); _timeAffected.ShadowBlinkHandler += OnShadowBlink; _timeAffected.PassPauseController (PauseController); _layeredController = GetComponent<LayeredController> (); _targetable = gameObject.GetComponent<Targetable> (); _targetable.DeathEventHandler += OnDeath; _camera = Camera.main.GetComponent<CameraController> (); _musicController = gameObject.GetComponent<MusicController> (); GetComponent<LayeredController> ().LayerChangedEventHandler += UpdateLayerTransparencyOnLayerChange; GetComponent<LayeredController> ().LayerChangedEventHandler += UpdateMusicOnLayerChange; _bigGearPrefab = (GameObject)Resources.Load ("BigGear"); _smallGearPrefab = (GameObject)Resources.Load ("SmallGear"); _bigGear = Instantiate (_bigGearPrefab).GetComponent<GearController> (); _bigGear.PassPauseController (PauseController); _smallGear = Instantiate (_smallGearPrefab).GetComponent<GearController> (); _smallGear.PassPauseController (PauseController); _bigGear.Player = this; _smallGear.Player = this; _bigGear.RotationSpeed = _bigGearDefaultRotationSpeed; _smallGear.RotationSpeed = _smallGearDefaultRotationSpeed; _bigGear.Damage = _bigGearDamage; _smallGear.Damage = _smallGearDamage; _layeredController.Initialize(); UpdateLayerTransparencyOnLayerChange(); SaveCheckpoint (); }
void MakeSingleton(){ if(instance != null){ Destroy(gameObject); } else { instance = this; DontDestroyOnLoad (gameObject); } }
public void Awake() { if (controller == null) { controller = this; DontDestroyOnLoad(gameObject); } else if (controller != this) Destroy(gameObject); }
// Use this for initialization void Start() { if(_instance == null) { _instance = this; DontDestroyOnLoad(gameObject); } else Destroy(gameObject); }
// Use this for initialization void Awake () { if(instance != null){ Destroy(gameObject); print("destroy duplicate music"); } else{ instance = this; GameObject.DontDestroyOnLoad(gameObject); } }
// Use this for initialization void Awake() { if (instance != null) { Destroy (gameObject); print ("Duplicate Music Player Destroyed"); } else { instance = this; GameObject.DontDestroyOnLoad(gameObject); } }
// Use this for initialization void Start() { if(instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else StartCoroutine(FadeMusic()); }
private void InstantiateController() { if(Instance == null) { Instance = this; DontDestroyOnLoad(this); } else if(this != Instance) { Destroy(this.gameObject); } }
private void Awake() { if (Instance != null) { Destroy(gameObject); return; } Transition = 1f; Instance = this; _audio = GetComponent<AudioSource>(); }
public LoadWordMap(string loadSource, int level, GameObject tilePrefab, GameObject levelCanvas, GameObject tileStartPoint, Sprite[] sprites, string json, MusicController _audio) { audioController = _audio; wordList = new List<Word> (); string content = json/*.text*/; JSONNode levels = JSON.Parse (content); int w = levels ["levels"] [level] ["width"].AsInt; int h = levels ["levels"] [level] ["height"].AsInt; for(int i = 0; i < w; i++){ for(int j = 0; j < h; j++){ Word word = new Word(levels["levels"][level], j, i); wordList.Add (word); } } int width = w; int height = h; tileData = new List<List<GameObject>>(); for(int y = 0; y < height; y++) { tileData.Add(new List<GameObject>()); } for(int x = 0; x < width; x++) { for(int y = 0; y < height; y++) { GameObject tileGameObject = CreateTile(tilePrefab, levelCanvas, tileStartPoint); Tile tile = tileGameObject.GetComponent<Tile>(); tile.audioController = audioController; tile.tileName = wordList[height*x + y].word; for(int i = 0; i < sprites.Length; i++){ Sprite temp = sprites[i]; if(temp.name == tile.tileName) tile.sprite = temp; } Vector3 pos = tileStartPoint.transform.position; BoxCollider2D box = tilePrefab.GetComponent<BoxCollider2D>(); pos.x += x * box.size.x * 2f; if(x > 1) pos.x += box.size.x; pos.y += y * -box.size.y * 2f; pos.z = tileStartPoint.transform.position.z; tile.transform.position = pos; tileData[y].Add(tileGameObject); } } }
void Awake() { if (musicControl == null) { DontDestroyOnLoad(gameObject); musicControl = this; } else if (musicControl != this) { Destroy(gameObject); } attemptCount = 0; }
IEnumerator FadeMusic() { yield return StartCoroutine(pTween.To (fadeCurve.lastTime(), t => { instance.audio.volume = fadeCurve.Evaluate(1-t); audio.volume = fadeCurve.Evaluate(t); })); Destroy(instance.gameObject); instance = this; DontDestroyOnLoad(gameObject); }
void Awake() { if (Music == null) { DontDestroyOnLoad(gameObject); Music = this; } else if (Music != this) { Destroy(gameObject); } }
void Awake() { //preserve the old instance if one already exists if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } //preserve the instance throughout scene change DontDestroyOnLoad(this.gameObject); }
void Start() { if (MusicController.Instance && MusicController.Instance != this) { Destroy(gameObject); } else if (!MusicController.Instance) { instance = this; } DontDestroyOnLoad (gameObject); }
void Awake() { if (instance != null) { Destroy (gameObject); print ("Duplicate Music Player Destroyed"); } else { instance = this; GameObject.DontDestroyOnLoad(gameObject); music = GetComponent<AudioSource>(); music.clip = startMusic; music.loop = true; music.Play(); } }
void Awake() { if (controller == null) { controller = this; DontDestroyOnLoad(gameObject); } else if (controller != this) { Destroy(gameObject); } audioSource = GetComponent<AudioSource>(); audioSource.loop = true; }
public SpawnDrop spawnDrop; //where player starts the game #endregion Fields #region Methods void Awake() { jgs = GameObject.FindGameObjectWithTag(TagsAndLayers.gameController).GetComponent<JumpGameState>(); musicController = GameObject.FindGameObjectWithTag(TagsAndLayers.musicController).GetComponent<MusicController>(); gameTimer = GameObject.FindGameObjectWithTag(TagsAndLayers.gameTimer).GetComponent<GameTimer>(); deathArea = GameObject.FindGameObjectWithTag(TagsAndLayers.deathArea).GetComponent<DeathArea>(); spawnDrop = GameObject.FindGameObjectWithTag(TagsAndLayers.spawnDrop).GetComponent<SpawnDrop>(); menuScreen = GameObject.FindGameObjectWithTag(TagsAndLayers.menuController).GetComponent<MenuScreen>(); pause = Camera.main.GetComponent<Pause>(); crosshair = Camera.main.GetComponent<Crosshair>(); objectSpawners = GameObject.FindGameObjectsWithTag(TagsAndLayers.objectSpawner); jumppadPillars = GameObject.FindGameObjectsWithTag(TagsAndLayers.jumppadPillar); player = GameObject.FindGameObjectWithTag(TagsAndLayers.player); }
// Use this for initialization void Awake() { if (instance != null) { print ("destroyed extra sound..."); GameObject.Destroy(gameObject); return; } audio = GetComponent<AudioSource> (); defaultMusic = audio.clip; updateMusicChoice (); DontDestroyOnLoad (gameObject); instance = this; }
public TestCaseBeatSyncedContainer() { Clock = new FramedClock(); Clock.ProcessFrame(); Add(new BeatContainer { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, }); Add(mc = new MusicController { Origin = Anchor.TopRight, Anchor = Anchor.TopRight, }); }
protected void Page_Load(object sender, EventArgs e) { width = Request.QueryString["w"]; lang = ConvertUtility.ToInt32(Request.QueryString["lang"]).ToString(); id = ConvertUtility.ToInt32(Request.QueryString["id"]); if (!IsPostBack) { //Detail DataTable dtDetail = MusicController.GetItemDetail(Session["telco"].ToString(), id); //end detail if (dtDetail.Rows.Count > 0) { price = ConfigurationSettings.AppSettings.Get("ringtoneprice"); if (lang == "1") { ltrTenAnh.Text = dtDetail.Rows[0]["SongNameUnicode"].ToString(); ltrCasy.Text = Resources.Resource.wCaSy + "<a Class=\"link-non-black\" href=\"" + UrlProcess.GetMusicByArtistUrlNew(lang, width, dtDetail.Rows[0]["ArtistID"].ToString()) + "\">" + dtDetail.Rows[0]["ArtistNameUnicode"] + "</a>"; ltrLuottai.Text = Resources.Resource.wLuotTai + dtDetail.Rows[0]["Download"].ToString().ToUpper(); ltrGiaTai.Text = Resources.Resource.wGiaTai + price + Resources.Resource.wDonViTien; lnkTai.Text = "<span class=\"bold\">" + Resources.Resource.wTaiVe + "</span>"; } else { ltrTenAnh.Text = dtDetail.Rows[0]["SongName"].ToString(); ltrCasy.Text = Resources.Resource.wCaSy_KD + "<a Class=\"link-non-black\" href=\"" + UrlProcess.GetMusicByArtistUrl(lang, width, dtDetail.Rows[0]["ArtistID"].ToString()) + "\">" + dtDetail.Rows[0]["ArtistName"] + "</a>"; ltrLuottai.Text = Resources.Resource.wLuotTai_KD + dtDetail.Rows[0]["Download"].ToString().ToUpper(); ltrGiaTai.Text = Resources.Resource.wGiaTai_KD + price + Resources.Resource.wDonViTien_KD; lnkTai.Text = "<span class=\"bold\">" + Resources.Resource.wTaiVe_KD + "</span>"; } if (id == 2843) { if (lang == "1") { ltrGiaTai.Text = "Miễn phí"; } else { ltrGiaTai.Text = "Mien phi"; } } lnkTai.NavigateUrl = "../DownloadNew.aspx?id=" + dtDetail.Rows[0]["W_MItemID"] + "&lang=" + lang + "&w=" + width; } } }
// Start is called before the first frame update void Start() { objectOffset = Random.Range(0, 100); Time.timeScale = 0; stage = 0; terrainSize = 128; objectThickness = 20; evolMultplier = 1; recordingGraph = "Speed"; renderQuality = 2; MusicController music = FindObjectOfType <MusicController>(); volumeSlider.value = music.audioSource.volume; if (music.audioSource.volume == 0) { volumeToggle.isOn = true; } }
// Use this for initialization void Start() { timeManager = FindObjectOfType <TimeManager>(); cpu = FindObjectOfType <CPUTextController>(); cameraManager = FindObjectOfType <CameraSwitcher>(); playerPositionStuff = FindObjectOfType <PlayerMove>(); mousePosition = FindObjectOfType <MouseLook>(); systemManager = FindObjectOfType <SystemManager>(); inventoryManager = FindObjectOfType <InventoryManager>(); inventoryChanger = FindObjectOfType <InventoryChanger>(); powerManager = FindObjectOfType <PowerManager>(); musicController = FindObjectOfType <MusicController>(); lightManager = FindObjectOfType <StationLighting>(); dayIndicatorText.canvasRenderer.SetAlpha(0.0f); dayIndicatorBackground.canvasRenderer.SetAlpha(0.0f); pauseMenu.SetActive(paused); LoadSavedGame(); }
void Awake() { if (instance != null && instance != this) { if (instance.GetComponent <AudioSource>().clip != GetComponent <AudioSource>().clip) { instance.GetComponent <AudioSource>().clip = GetComponent <AudioSource>().clip; instance.GetComponent <AudioSource>().volume = GetComponent <AudioSource>().volume; instance.GetComponent <AudioSource>().Play(); } Destroy(this.gameObject); return; } instance = this; GetComponent <AudioSource>().Play(); DontDestroyOnLoad(this.gameObject); }
public void Awake() { myTransform = transform; if (Instance != null) { DestroyImmediate(gameObject); } //Debug.Log ("there is 2 MusicControllers"); else { Instance = this; } DontDestroyOnLoad(gameObject); }
//当前对象的编号 //int object_num; void Start() { //获取物体本身 Player = gameObject.transform; position_reset = gameObject.transform.position; rotation_reset = gameObject.transform.rotation; //获取外层物体 father_object = transform.parent.gameObject.transform.parent.gameObject; //获取脚本内容 game_controller = GameObject.Find("GameController").GetComponent <A_1_GameController>(); musicControlScript = GameObject.Find("MusicController").GetComponent <MusicController>(); scoreBarScript = GameObject.Find("UI/StarBar").GetComponent <A_1_ScoreBar>(); //设置对象为待机 animIndex = 0; }
void Awake() { if (instance != null) { Debug.LogWarning("[MusicController] Multiple instances of this singleton found! In scene: " + Application.loadedLevelName); Destroy(gameObject); return; } instance = this; audioSrc = audio; DontDestroyOnLoad(gameObject); UpdatePlaymakerReferences(); IPodPlayerEventsHandler.OnIPodPlayStateChanged += OnIPodPlayStateChangedEvent; IPodPlayerEventsHandler.OnIPodPlayStatusChecked += OnIPodPlayStatusCheckedEvent; }
public void RemoveMe() { if (!destroyed) { numEnemies--; print("Remove enemy " + gameObject.name + "=" + numEnemies); destroyed = true; if (numEnemies <= 0) { MusicController.PlayCalmMusic(); numEnemies = 0; if (puzzleHandler) { puzzleHandler.PuzzelIsCleared(); } } } }
void Awake() { if (Instance == null) { Instance = this; } DontDestroyOnLoad(this.gameObject); menuMusic = FMOD_StudioSystem.instance.GetEvent("event:/02_music/music_menu"); gameMusic = FMOD_StudioSystem.instance.GetEvent("event:/02_music/music_game"); menuMusic.getPlaybackState(out menuMusicPlaybackState); gameMusic.getPlaybackState(out gameMusicPlaybackState); //Debug.Log ("Starting menu music"); menuMusic.start(); }
void Awake() { if (instance != null) { Debug.LogWarning("[MusicController] Multiple instances of this singleton found! In scene: " + Application.loadedLevelName); Destroy(gameObject); return; } instance = this; audioSrc = audio; DontDestroyOnLoad(gameObject); UpdatePlaymakerReferences(); IPodPlayerEventsHandler.OnIPodPlayStateChanged += OnIPodPlayStateChangedEvent; IPodPlayerEventsHandler.OnIPodPlayStatusChecked += OnIPodPlayStatusCheckedEvent; }
// Update is called once per frame void Update() { if (monster == null) { monster = FindMonster(); } else { if (playedSong == false) { playedSong = true; MusicController.PlaySong(songNumber); } MusicController.SetProgress(monster.PercentageFull); // 0 = starting, .5 = halfway there, 1 = finished! Progress = monster.PercentageFull; } }
private void Awake() { if (inst == null) { inst = this; } else { Destroy(this); } DontDestroyOnLoad(gameObject); source = GetComponent <AudioSource>(); ResetMusic(); SceneManager.sceneLoaded += (a, b) => ResetMusic(); }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else if (instance.GetComponent <AudioSource>().clip != GetComponent <AudioSource>().clip) { Destroy(instance.gameObject); instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public static IEnumerator FadeOut(MusicController musicController, MusicTrack musicTrack, float FadeTime) { AudioSource audioSource = musicTrack.AudioSource; float startVolume = musicController.IsMuted() ? 0 : musicController.defaultVolume; while (audioSource.volume > 0 && musicController.currentTrack.GetInstanceID() != musicTrack.GetInstanceID()) { musicController.SetVolume(audioSource, audioSource.volume - (startVolume * Time.deltaTime / FadeTime)); yield return(null); } if (musicController.GetInstanceID() != musicTrack.GetInstanceID()) { audioSource.Stop(); musicController.SetVolume(audioSource, startVolume); } }
IEnumerator PlayerDead() { float time = manager.timeToDie; MusicController.MusicStop(); MusicController.PlayClipAt(death, transform.position); ToogleColliders(false); isDead = true; player.AddForce(new Vector2(0, 20), ForceMode2D.Impulse); while (time > 0) { time -= Time.deltaTime; yield return(null); } manager.PlayerDeath(); }
public void GrowUp(bool canSuperGrow) { if (!isGrown) { isGrown = true; startJumpForce = jumpForceGrown; StartCoroutine(Blink(Grown, Small, true)); } else { if (canSuperGrow) { StartCoroutine(Blink(SuperGrown, Grown, true)); } } ResetColor(); MusicController.PlayClipAt(PowerUp, transform.position); }
public void OnDropDefault(GameObject cell) { if (cell.transform.childCount == 0) { if (awakeAudio) { MusicController.PlayOnce(awakeAudio); } var c = cell.GetComponent <Cell>(); if (c.isPrison) { AddPoints(1); } SetParentAndNext(cell); return; } MoveToBack(); }
void Start() { //Get GameDataManager Controller Main Instance DataManager = GameDataManager.ManangerInstance; //Get Music Controller Main Instance musicController = MusicController.ControllerInstance; //Set the EventDelegate for All of The Level Buttons To Load the Right Level //Level Scene Names Should be Like These => "Level0","Level1",.....,"Level47" for (int i = 0; i < Levels.Count; i++) { EventDelegate del = new EventDelegate(this, "StartLoading"); del.parameters[0].value = "Level" + (i); Levels[i].Button.onClick.Add(del); } StartCoroutine(StartingTransition()); }
private void CancelDissolve() { StopCoroutine(_dissolveCoroutine); StopCoroutine(_tickCoroutine); clockSound.Stop(); MusicController.GetInstance().ToggleLowpass(false); _isDying = false; dissolveMaterial.SetFloat(Progress, 0.0f); for (int i = 0; i < _meshRenderers.Length; i++) { _meshRenderers[i].material = _defaultMaterials[i]; } onDeathCanceled?.Invoke(); }
void Start() { // Vector3 Size = Camera.main.ScreenToWorldPoint(new Vector3 (Screen.width, 0, 0)); // spawnValues.x = Mathf.Floor (Size.x); // StartCoroutine (SpawnWaves ()); health = 100; score = 0; musicController = (MusicController)GetComponent(typeof(MusicController)); PlayerPrefs.SetInt(kHealth, health); PlayerPrefs.SetInt(kScore, score); levelIsRunning = true; GameLabel.text = ""; if (level == 1) { InfoText.text = "Warning! Asteroids ahead"; StartCoroutine("SpawnWaves"); } else if (level == 2) { InfoText.text = "Look Out! Enemies are coming"; StartCoroutine("SpawnWaves"); } else if (level == 3) { InfoText.text = "Prepare for battle!"; StartSpawningWaves(); } else { InfoText.text = "Get Ready!"; StartCoroutine("SpawnWaves"); } }
protected void Page_Load(object sender, EventArgs e) { width = Request.QueryString["w"]; lang = ConvertUtility.ToInt32(Request.QueryString["lang"]).ToString(); StyleID = Request.QueryString["id"].ToString(); if (!string.IsNullOrEmpty(Request.QueryString["cpage"])) { curpage = ConvertUtility.ToInt32(Request.QueryString["cpage"]); } //start category list int totalrecord = 0; DataTable dtCat = MusicController.GetItemByStyleHasCache(Session["telco"].ToString(), StyleID, curpage, pagesize, out totalrecord); rptList.DataSource = dtCat; //rptList.ItemDataBound += new RepeaterItemEventHandler(rptlstCategory_ItemDataBound); rptList.DataBind(); if (!IsPostBack) { DataTable StyleInfo = MusicController.GetStyleByIDHasCache(StyleID); if (StyleInfo.Rows.Count > 0) { //if (lang == "1") //{ ltrStyleName.Text = StyleInfo.Rows[0]["StyleNameUnicode"].ToString(); string name = StyleInfo.Rows[0]["StyleName"].ToString(); // ltrSobai.Text = Resources.Resource.wSoBai + totalrecord.ToString(); //} //else //{ // ltrStyleName.Text = "<span class=\"bold\" style=\"color:#B200B2;\">" + StyleInfo.Rows[0]["StyleName"].ToString() + "</span>"; // ltrSobai.Text = Resources.Resource.wSoBai_KD + totalrecord.ToString(); //} Paging1.totalrecord = totalrecord; Paging1.pagesize = pagesize; Paging1.numberpage = pagenumber; Paging1.defaultparam = UrlProcess.AmNhacChuyenMucTheLoaiList(StyleID, name, curpage.ToString()); Paging1.queryparam = UrlProcess.AmNhacChuyenMucTheLoaiList(StyleID, name, curpage.ToString()); } } }
private void SummonBoss() { //Точка появления босса Vector2 bossRespPoint = WaypointController.instance.bossRespPoint.position; //Точка где заканчивается интро-анимация Vector2 bossGamePoint = WaypointController.instance.bossGamePoint.position; //Создание босса GameObject bossShip = builder.CreateBossShip(); bossShip.transform.position = bossRespPoint; //Музыкальная тема босса MusicController.LoadMusic("Boss"); //Интро. Босс спускается к игроку LeanTween.moveLocalY(bossShip, bossGamePoint.y, BOSS_INTRO_TIME).setOnComplete(() => bossShip.GetComponent <BossShip>().StartAttackPhase()); }
public float effectVolume = 1f; // Current effect volume void Awake() { audioSource = gameObject.GetComponent <AudioSource>(); audioSource.playOnAwake = false; audioSource.loop = true; if (control == null) // If there are no control objects (this is the main one) { // This stuff will be saved in a file later and called from various functions ///// Load(); maxVolume = musicVolume; audioSource.volume = musicVolume; /////////////////////////////////////////////////////////////////////////////////// PlayNewClip(musicclip); // Play the musicclip DontDestroyOnLoad(gameObject); // Persist control = this; // Reference itself gameObject.transform.parent = null; } else if (control != this) // If there is already a control object { if (musicclip != null) // If there is music on this MusicController { if (MusicController.control.musicclip == null) // If main controller has null music, put it on the music controller that exists { MusicController.control.PlayNewClip(musicclip); } else if (musicclip.name != MusicController.control.audioSource.clip.name) // If this is new music - put it on the music controller that exists { MusicController.control.Fade_Play_Unfade(musicclip); } else { MusicController.control.UnFadeMusic(); } } Destroy(gameObject); // Information has been sent to the main MusicControl object - delete the duplicate } }
// Use this for initialization void Start() { //Instatiate a object of the script instance = this; m_MyAudioSource = GetComponent <AudioSource>(); if (PlayerPrefs.GetInt("isMusicOff") == 0) { if (!isPlaying) { m_MyAudioSource.Play(); isPlaying = true; } } else { stopMusic(); } DontDestroyOnLoad(this.gameObject); }
// required for items which dragged directly void OnMouseUp() { if (!draggable) { return; } dragged = false; var cell = Hit(); OnCellDrop(cell); if (OnCellCanDrop(cell)) { if (placeAudio) { MusicController.PlayOnce(placeAudio); } } }
public override void OnEnter() { IMusicController musicController = MusicController.GetInstance(); if (musicController != null) { musicController.SetAudioVolume(volume, fadeDuration, () => { if (waitUntilFinished) { Continue(); } }); } if (!waitUntilFinished) { Continue(); } }
// Update is called once per frame void FixedUpdate() { var cameraPosX = mainCamera.transform.position.x; if (cameraPosX > lastCameraPos + enemiesGenerationLength) { generateEnemies( cameraPosX + generationOffest, cameraPosX + generationOffest + enemiesGenerationLength); lastCameraPos = cameraPosX; } if (!MusicController.soundCollection[MusicController.SOUNDS.MENU].isPlaying && !MusicController.soundCollection[MusicController.SOUNDS.GAME_INTRO].isPlaying && !MusicController.soundCollection[MusicController.SOUNDS.GAME_LOOP].isPlaying) { MusicController.SoundController(MusicController.SOUNDS.GAME_LOOP, true); } }
} = false; //Default value, though, this should be linked somehow with the current status of the view, to ensure robustness. public MediaStyleNotification(OpenNotification openNotification, ref LinearLayout notificationView, AndroidX.Fragment.App.Fragment notificationFragment) : base(openNotification, ref notificationView, notificationFragment) { var notificationMediaArtwork = new BitmapDrawable(Application.Context.Resources, OpenNotification.MediaArtwork()); //Only post the Artwork if this notification isn't the one that keeps the Music Widget Active (because in that case it will cause redundancy, the Music Widget //will be already showing the Artwork) if (MusicController.MediaSessionAssociatedWThisNotification(openNotification.GetCustomId()) == false) { WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs { BlurLevel = 1, OpacityLevel = 125, SecondsOfAttention = 5, Wallpaper = notificationMediaArtwork, WallpaperPoster = WallpaperPoster.Notification, }); } }
} // End of Start // Function called before 'Start()', just after prefab is instantiated. private void Awake() { // If there is instance of game music and it is not this one. if((instance!=null)&&(instance!=this)) { // Destroy game music player (just in case some minor bug will happen). Destroy(this.gameObject); // Debug error. Debug.LogWarning("Duplicate music player self-destructed!"); } // If there is no instance of game music. else { // Save instance. instance=this; // Make sure that music will not stop after loading another scene. GameObject.DontDestroyOnLoad(this.gameObject); } } // End of Awake
// -------------------- // Main Game Loops // -------------------- //void Update() //{ // if(gameStatus == "FlipMode") // { // } // else if(gameStatus == "StartScene") // { // } // else if (gameStatus == "EndScene") // { // } //} // ----------- // UI Buttons / Music // ----------- public void homeButtonClicked() { // Play sound effect if (sfxControllerScript) { sfxControllerScript.Play_SFX_UI_Back(); } // Switch to menu music GameObject musicManager = GameObject.Find("Music Controller"); if (musicManager) { MusicController musicManagerScript = musicManager.GetComponent <MusicController>(); musicManagerScript.PlayMenuMusic(); } SceneManager.LoadScene("Menu - Levels"); }
public void SwitchScene(string scene) { musicController = GameObject.Find ("MusicController").GetComponent<MusicController>(); if (scene == "titleScreen") { musicController.Transition(1); } else if (scene == "castle") { musicController.Transition(2); } else if (scene == "winScreen") { musicController.Transition(3); } else if (scene == "gameOverScreen") { musicController.Transition(4); } Application.LoadLevel (scene); }
void Start() { // Get the body of Kirby. myBody = GetComponent<Rigidbody2D>(); // Get my animation sheet. myAnim = GetComponent<Animator>(); // Get my music controller. myMusic = MusicController.FindObjectOfType<MusicController>(); // Get my sfx. jumpSource = GetComponent<AudioSource>(); blockSource = GetComponent<AudioSource>(); }
void Start() { // Vector3 Size = Camera.main.ScreenToWorldPoint(new Vector3 (Screen.width, 0, 0)); // spawnValues.x = Mathf.Floor (Size.x); // StartCoroutine (SpawnWaves ()); health = 100; score = 0; musicController = (MusicController) GetComponent (typeof (MusicController)); PlayerPrefs.SetInt (kHealth, health); PlayerPrefs.SetInt (kScore, score); levelIsRunning = true; GameLabel.text = ""; if (level == 1) { InfoText.text = "Warning! Asteroids ahead"; StartCoroutine ("SpawnWaves"); } else if (level == 2) { InfoText.text = "Look Out! Enemies are coming"; StartCoroutine ("SpawnWaves"); } else if (level == 3) { InfoText.text = "Prepare for battle!"; StartSpawningWaves (); } else { InfoText.text = "Get Ready!"; StartCoroutine ("SpawnWaves"); } }
private void load(MusicController music) { StateContainer = music; Action = music.ToggleVisibility; }
void Start() { agent = GetComponent<NavMeshAgent>(); if (agent != null) { nav = true; } h = FindObjectOfType<health>(); mc = FindObjectOfType<MusicController>(); }
// Use this for initialization void Start () { music = GetComponent<MusicController> (); combo = GetComponent<ComboCreator> (); NewRound (); }
void OnTriggerEnter2D(Collider2D coll) { musicController = GameObject.Find ("MusicController").GetComponent<MusicController> (); musicController.Transition (3); Application.LoadLevel ("winScreen"); }
public MusicController() { if (Instance == null) { Instance = this; } }
void Start() { h = FindObjectOfType<health>(); mc = FindObjectOfType<MusicController>(); }
void Awake() { lightsController = GetComponent<LightsController>(); messageController = GetComponent<WallMsgController>(); musicController = GetComponent<MusicController> (); }