Пример #1
0
        /// <summary>
        /// Find references. Update volume.
        /// </summary>
        private void Start()
        {
            audioSource   = GetComponent <AudioSource>();
            reference     = FindObjectOfType <ReferenceManager>();
            optionsValues = reference.optionsValues;

            if (optionsValues == null)
            {
                optionsValues = FindObjectOfType <OptionsValues>();
            }

            UpdateVolume();
        }
Пример #2
0
        //----------------------------------------
        //
        // Methods
        //
        //----------------------------------------

        /// <summary>
        /// Calls any functions needed to initialize any managers.
        /// </summary>
        private void Awake()
        {
            if (enemyAttributes != null)
            {
                enemyAttributes.Initialize(this);
            }

            if (objectPoolManager != null)
            {
                objectPoolManager.Initialize(this);
            }

            if (gameSettings == null)
            {
                gameSettings = FindObjectOfType <GameSettings>();
            }

            if (colorBlindMode == null)
            {
                colorBlindMode = FindObjectOfType <ColorBlindMode>();
            }

            if (waveManager != null)
            {
                waveManager.Initialize(this);
            }

            if (infinite != null)
            {
                infinite.Initialize(this);
            }

            if (statistics == null)
            {
                statistics = FindObjectOfType <PlayerStats>();
            }

            if (optionsValues == null)
            {
                optionsValues = FindObjectOfType <OptionsValues>();
            }

            if (rocketAttributes != null)
            {
                rocketAttributes.Initialize(this);
            }

            if (shipLookTarget == null)
            {
                shipLookTarget = GameObject.Find("Ship Look Target");
            }

            try
            {
                playerLookTarget.transform.parent        = GameObject.Find("VRCamera").transform;
                playerLookTarget.transform.localPosition = Vector3.zero;
            }
            catch (Exception)
            {
                try
                {
                    playerLookTarget.transform.parent        = GameObject.Find("FallbackObjects").transform;
                    playerLookTarget.transform.localPosition = Vector3.zero;
                }
                catch (Exception)
                {
                    Debug.LogError(GetType().Name + " - Cannot find VRCamera and FallbackObjects.");
                }
            }

            if (bossManager != null)
            {
                if (gameSettings.selectedGameMode == GameSettings.GameMode.SoloNormal)
                {
                    bossManager.Initialize(this);
                }
            }

            if (gameSettings.selectedGameMode == GameSettings.GameMode.SoloInfinite)
            {
                shipPickup.SetActive(true);
                tooltips.SpawnGrabShip();
            }

            if (tooltips != null)
            {
                tooltips.Initialize(this);
            }
        }