예제 #1
0
        protected override void Awake()
        {
            base.Awake();
            canvas   = GetComponent <Canvas>();
            settings = GetComponent <HUDSettings>();

            //the canvas needs an event camera set up to process events correctly. Try to use main camera if no one is provided.
            if (canvas.worldCamera == null && Camera.main != null)
            {
                canvas.worldCamera = Camera.main;
            }
        }
예제 #2
0
        public HUDSettings FindParentSettings(bool forceNew = false)
        {
            if (settings == null || forceNew)
            {
                settings = GetComponentInParent <HUDSettings>();

                if (settings == null)
                {
                    return(null);
                }
                else
                {
                    canvas = settings.GetComponent <Canvas>();
                    angle  = settings.Angle;

                    myImage = GetComponent <Image>();
                }
            }

            return(settings);
        }