示例#1
0
        /// <summary>
        /// To build up a listener monitoring cursorHovering property, a static method will be assigned in Start().
        /// </summary>
        static void UpdateCursorHovering()
        {
            // Find what the cursor hits.
            RadiacPanel res = null;

            foreach (var i in all)
            {
                if (i.active && i.IsPointInsidePanel(VirtualCursor.position))
                {
                    if (res == null || i.gameObject.transform.position.z < res.gameObject.transform.position.z)
                    {
                        res = i;
                    }
                }
            }

            // Set the hit and its parent objects "cursorHovering".
            foreach (var i in all)
            {
                i.cursorHovering = false;
            }

            while (res != null)
            {
                res.cursorHovering = true;
                res = res.gameObject.transform.parent.GetComponent <RadiacPanel>();
            }
        }
        void Awake()
        {
            if (instance != null)
            {
                Log.AddWarning("Radiac Environment replaced.");
            }

            instance = this;

            RadiacUpdates      = () => { };
            RadiacFixedUpdates = () => { };
            RadiacGUICallback  = () => { };

            // Static initialization are placed here.

            LocalizationSupport.LoadLocalizationFile();

            RadiacPanel.GlobalInit();
            VirtualCamera.Init();
            VirtualCursor.Init();
            RadiacInputController.Init();
        }