示例#1
0
        void Awake()
        {
            m_Bounds      = GameObject.FindGameObjectWithTag("Bounds").GetComponent <ScreenBounds>();
            m_GameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>();
            m_BombUI      = GameObject.FindGameObjectWithTag("BombUI").GetComponentInChildren <PlayerItemUI>();

            m_GameState = GameObject.FindGameObjectWithTag("UI").GetComponent <PauseHandler>();

            m_Health = FindObjectOfType <PlayerHealth>();
        }
示例#2
0
        void Awake()
        {
            m_GameManager   = GameObject.FindObjectOfType <GameManager>();
            m_PlayerLivesUI = GameObject.FindGameObjectWithTag("LivesUI").GetComponentInChildren <PlayerItemUI>();

            m_ShootController = GetComponent <PlayerShootController>();

            m_AudioPlayer = FindObjectOfType <AudioPlayer>();

            m_AudioControls = FindObjectOfType <BGMAudioPlayer>();

            if (m_AudioControls == null)
            {
                var audioObj = new GameObject("BGM");
                audioObj.AddComponent <AudioSource>();
                m_AudioControls = audioObj.AddComponent <BGMAudioPlayer>();
            }

            m_Collider = GetComponent <Collider2D>();

            m_CurrentLives = initialLives;
        }