void Awake() { m_RoundText = GameObject.FindGameObjectWithTag("UI").GetComponentInChildren <RoundText>(); m_ShopController = shop.GetComponent <ShopController>(); m_CameraShake = Camera.main.GetComponent <CameraShake>(); m_PlayerShootController = player.GetComponent <PlayerShootController>(); m_PlayerController = player.GetComponent <PlayerController>(); var storage = GameObject.FindGameObjectWithTag("RoundPersistent"); if (storage == null) { storage = new GameObject("Round_Persistent") { tag = "RoundPersistent" }; m_RoundStorage = storage.AddComponent <RoundPersistentScore>(); } else { m_RoundStorage = storage.GetComponent <RoundPersistentScore>(); } m_BGMAudioPlayer = FindObjectOfType <BGMAudioPlayer>(); if (m_BGMAudioPlayer == null) { var audioObj = new GameObject("BGM"); audioObj.AddComponent <AudioSource>(); m_BGMAudioPlayer = audioObj.AddComponent <BGMAudioPlayer>(); } m_AudioPlayer = Camera.main.GetComponent <AudioPlayer>(); }
void Awake() { if (HIGH_SCORE == null) { HIGH_SCORE = GameObject.FindGameObjectWithTag("RoundPersistent").GetComponent <RoundPersistentScore>(); } if (GRID == null) { GRID = GameObject.FindObjectOfType <WarpGrid.WarpingGrid>(); } if (AUDIO_PLAYER == null) { AUDIO_PLAYER = Camera.main.GetComponent <AudioPlayer>(); } }
void Awake() { if (GAME_MANAGER == null) { GAME_MANAGER = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>(); } if (HIGH_SCORE == null) { HIGH_SCORE = GameObject.FindGameObjectWithTag("RoundPersistent").GetComponent <RoundPersistentScore>(); } if (BGM_AUDIO == null) { BGM_AUDIO = GameObject.FindObjectOfType <BGMAudioPlayer>(); } }
void Start() { if (HIGH_SCORE == null) { HIGH_SCORE = GameObject.FindGameObjectWithTag("RoundPersistent").GetComponent <RoundPersistentScore>(); } if (BGM_AUDIO == null) { BGM_AUDIO = GameObject.FindObjectOfType <BGMAudioPlayer>(); } pauseMenu.SetActive(false); isPaused = false; DisableButton(); }