private void Awake() { if (instance == null) { instance = this; } else if (instance != null) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); musicSource = gameObject.AddComponent<AudioSource>(); musicSource.loop = true; musicSource.outputAudioMixerGroup = musicMixer; sfxSource = gameObject.AddComponent<AudioSource>(); sfxSource.outputAudioMixerGroup = sfxMixer; bulletsSource = gameObject.AddComponent<AudioSource>(); bulletsSource.outputAudioMixerGroup = bulletsMixer; swordSource = gameObject.AddComponent<AudioSource>(); swordSource.outputAudioMixerGroup = swordMixer; hitsSource = gameObject.AddComponent<AudioSource>(); hitsSource.outputAudioMixerGroup = hitsMixer; powerupsSource = gameObject.AddComponent<AudioSource>(); powerupsSource.outputAudioMixerGroup = powerupsMixer; }
// Start is called before the first frame update void Start() { // コンポーネントを取得する m_audio = m_audioManager.GetComponent <AudioManager_Script>(); // アタッチする m_audio.AttachBGMSource = m_bgmResource.GetComponent <AudioSource>(); m_audio.AttachSESource = m_seResource.GetComponent <AudioSource>(); if (m_sceneManager == null) { // SceneManager m_sceneManager = new SceneManager_Script(); m_sceneManager.Initialize(m_audio); } }
/// <summary> /// 初期化処理 /// </summary> public void Initialize(AudioManager_Script audio) { // 既にあるなら処理しない if (CheckInstance() == false) { return; } // Audio m_audio = audio; // Scene CreateScene(); // 最初のシーンを設定する SetFirstScene(); }
// Use this for initialization void Start() { Panel_Menu = GameObject.Find("Panel_Menu"); PanelTween_Menu = Panel_Menu.GetComponent <UITweener>(); Panel_Gameover = GameObject.Find("Panel_Gameover"); PanelTween_Gameover = Panel_Gameover.GetComponent <UITweener>(); Panel_Gameplay = GameObject.Find("Panel_Gameplay"); PanelTween_Gameplay = Panel_Gameplay.GetComponent <UITweener>(); PanelTween_Gameplay_NonGameover = GameObject.Find("NonGameover_Container").GetComponent <UITweener>(); Panel_Pause = GameObject.Find("Panel_Pause"); PanelTween_Pause = Panel_Pause.GetComponent <UITweener>(); Panel_Darklayer = GameObject.Find("Panel_Darklayer"); PanelTween_Darklayer = Panel_Darklayer.GetComponent <UITweener>(); Panel_Info = GameObject.Find("Panel_Info"); PanelTween_Info = Panel_Info.GetComponent <UITweener>(); Instruction_Text = GameObject.Find("Instruction_Text").GetComponent <UITweener>(); Instruction_Shape_L = GameObject.Find("Shape_Left").GetComponent <UITweener>(); Instruction_Shape_R = GameObject.Find("Shape_Right").GetComponent <UITweener>(); //shapes_TweenPos = GameObject.Find("Panel_Shapes").GetComponent<TweenPosition>(); //shapes_TweenScale = GameObject.Find("Panel_Shapes").GetComponent<TweenScale>(); shapes_TweenPos = GameObject.Find("Shape_Move_Container").GetComponent <TweenPosition>(); shapes_TweenScale = GameObject.Find("Shape_Container").GetComponent <TweenScale>(); score_TweenPos = GameObject.Find("Scores_Container").GetComponent <TweenPosition>(); gameoverText_TweenPos = GameObject.Find("GameoverSprite").GetComponent <TweenPosition>(); twitterBtn_TweenPos = GameObject.Find("Control_TwitterButton").GetComponent <TweenPosition>(); chosenShapeText_L = GameObject.Find("ChosenShape_Text_L").GetComponent <UITweener>(); chosenShapeText_R = GameObject.Find("ChosenShape_Text_R").GetComponent <UITweener>(); score_TweenAlpha = scoreLbl.GetComponent <TweenAlpha>(); highscore_TweenAlpha = highScoreLbl.GetComponent <TweenAlpha>(); SMS = this.GetComponent <ShapeManager_Script>(); CMS = this.GetComponent <ColourManager_Script>(); SLS = this.GetComponent <SaveLoad_Script>(); TWS = this.GetComponent <Twitter_Script>(); GAS = this.GetComponent <Analytics_Script>(); ADS = Camera.main.GetComponent <AdMob_Script>(); AMS = GameObject.Find("AudioManager").GetComponent <AudioManager_Script>(); amountOfShapes = SMS.GetAmountOfShapes(); currentCountdown = maxCountdown; LoadHighScore(); UpdateHighscore(); if (currentGameState == GameStates.Menu) { GAS.SetScreen("Menu"); } }