public void RenderCamera(HvrRender hvrRender, HVRViewportInterface viewport, bool resizedViewport = false)
        {
            // If the Unity viewport has been resized and an OpenGL renderer
            // is in use then Unity will have recreated the main OpenGL
            // context so all framebuffer and vertex attribute objects that
            // are not shareable need to be destroyed and recreated.
            //
            // The extra call to `PlayerInterface.PreRender()` in this case is
            // to make sure that the vertex buffers are populated for the
            // render call below to avoid flickering.
            if (resizedViewport)
            {
                StaticInterface.Self().ResetFrameBuffersAndMeshes();
                PlayerInterface.PreRender(SceneInterface.Self().hvrSceneInterface);
                PlayerInterface.PreRender(SceneInterface.Self().hvrSceneInterface);
            }

            Update();
            LateUpdate();

            if (!SceneInterface.Self().sceneHasPreRendered)
            {
                PlayerInterface.PreRender(SceneInterface.Self().hvrSceneInterface);
                SceneInterface.Self().sceneHasPreRendered = true;
            }

            PlayerInterface.Render(SceneInterface.Self().hvrSceneInterface, viewport);
        }
 void Update()
 {
     if (Application.isPlaying)
     {
         StaticInterface.Self().Update(Time.unscaledTime);
     }
 }
        public void UnityEditorUpdate()
        {
#if UNITY_EDITOR
            if (Application.isEditor && !Application.isPlaying)
            {
                float editorTime = (float)EditorApplication.timeSinceStartup;

                StaticInterface.Self().UnityEditorUpdate(editorTime);
                SceneView.RepaintAll();
            }
#endif
        }
Exemple #4
0
    private void Awake()
    {
        itemSlotContainer = transform.Find("itemSlotContainer");

        // Deactivating inventory UI if active
        foreach (Transform child in transform)
        {
            child.gameObject.SetActive(false);
        }
        isInventoryActive    = false;
        playerShipController = GameObject.FindGameObjectWithTag("PlayerTag").transform.parent.GetComponent <ShipController>();

        for (int i = 0; i < inventory.GetSlots.Length; i++)
        {
            inventory.GetSlots[i].parent         = this;
            inventory.GetSlots[i].OnAfterUpdate += OnSlotUpdate;
        }

        // Check for setup errors
        if (this.GetComponent <DynamicInterface>() != null)
        {
            itemSlotTemplate = itemSlotContainer.Find("itemSlotTemplate");
            Button slotButton = itemSlotTemplate.GetComponent <Button>();
            if (slotButton.colors.normalColor == slotButton.colors.highlightedColor)
            {
                Debug.LogWarning(string.Concat(slotButton.gameObject.name, "'s button's normal color and highlighted color are the same. Slot highlighting on cursor enter may not work as intended."));
            }
        }

        StaticInterface IStatic = this.GetComponent <StaticInterface>();

        if (IStatic != null)
        {
            foreach (GameObject slot in IStatic.slots)
            {
                Button slotButton = slot.GetComponent <Button>();
                if (slotButton.colors.normalColor == slotButton.colors.highlightedColor)
                {
                    Debug.LogWarning(string.Concat(slotButton.gameObject.name, "'s button's normal color and highlighted color are the same. Slot highlighting on cursor enter may not work as intended."));
                }
            }
        }
    }
Exemple #5
0
 private void Awake()
 {
     inventory = FindObjectOfType <DynamicInterface>();
     equipment = FindObjectOfType <StaticInterface>();
 }
 private void Awake()
 {
     inventory = FindObjectOfType <DynamicInterface>();
     equipment = FindObjectOfType <StaticInterface>();
     text      = GetComponent <TextMeshProUGUI>();
 }
 void LateUpdate()
 {
     StaticInterface.Self().LateUpdate();
 }
 public void ResetFrameBuffersAndMeshes()
 {
     StaticInterface.Self().ResetFrameBuffersAndMeshes();
 }