Ejemplo n.º 1
0
    private void Awake()
    {
        if (!_hudCanvasManager)
        {
            _hudCanvasManager = FindObjectOfType <HUDCanvasManager>();
            if (_hudCanvasManager)
            {
                //DontDestroyOnLoad(gameObject);
            }
        }
        if (instance == null)
        {
            _hudCanvasManager = this;
            //DontDestroyOnLoad(gameObject);
        }
        else
        {
            if (instance != this)
            {
                Destroy(gameObject);
            }
        }

        audioSource = GetComponent <AudioSource>();
    }
    /* Setup access to this script through the singleton object */
    void Awake()
    {
        /* __ Disable On-screen controls when keyboard and mouse __ */
        if ( (SystemInfo.deviceType == DeviceType.Desktop) && disableOnMobile)
        {
            //we are on a desktop device, so don't use touch
            if (joystick != null)
            {
                joystick.SetActive(false);
            }

            if (shootButton != null)
            {
                shootButton.gameObject.SetActive(false);
            }
        }

        if (singleton != null)
        {
            Debug.LogError("Multiple instances of HUDCanvasManager!");
        }
        singleton = this;
        disableHUD(true);
    }