Пример #1
0
    /// <summary>
    /// Update is called every frame, if the MonoBehaviour is enabled.
    /// </summary>
    void Update()
    {
        /// Check if there is a placed object in the scene.
        if (_interactionHandler.GetPlacedObjectCount() == 0)
        {
            /// Disable the undo and start scene buttons.
            for (int i = 3; i < 5; i++)
            {
                buttons[i].interactable = false;
            }

            /// Check if the placement pose of the placement indicator is valid.
            if (!_interactionHandler.GetPlacementValidity())
            {
                /// The pose is not valid; adjust all UI placement buttons.
                for (int i = 0; i < 3; i++)
                {
                    buttons[i].interactable = false;
                }

                /// Update _hasDisabledButtons.
                _hasDisabledButtons = true;
            }
            else if (_hasDisabledButtons)
            {
                /// The pose is valid; enable all UI placement buttons.
                for (int i = 0; i < 3; i++)
                {
                    buttons[i].interactable = true;
                }

                /// Update _hasDisabledButtons.
                _hasDisabledButtons = false;
            }
        }
        else
        {
            /// Adjust the button interactability.
            for (int i = 0; i < buttons.Count; i++)
            {
                if (i < 3)
                {
                    /// Disable the rotation and placement buttons.
                    buttons[i].interactable = false;
                }
                else
                {
                    /// Enable the undo and start scene buttons.
                    buttons[i].interactable = true;
                }
            }
        }
    }