using UnityEngine;

public class HideStandard_UI_Elements : MonoBehaviour
{

    /*************************************************************************
   *
   * ARConnex CONFIDENTIAL
   * __________________
   *
   *  [2017] - [2021] ARConnex Incorporated
   *  All Rights Reserved.
   *
   * NOTICE:  All information contained herein is, and remains
   * the property of ARConnex Incorporated and its suppliers,
   * if any.  The intellectual and technical concepts contained
   * herein are proprietary to ARConnex Incorporated
   * and its suppliers and may be covered by U.S. and Foreign Patents,
   * patents in process, and are protected by trade secret or copyright law.
   * Dissemination of this information or reproduction of this material
   * is strictly forbidden unless prior written permission is obtained
   * from ARConnex Incorporated.
   */

    // How to use
    // Place this component on any game object in your assetbundle and set the control item you would like to hide.
    // Option are Spin Button, Flip Button, Mute Button and Size Button (Note Size Button is only used when in Ground Plane mode).


    bool UIOverrideRunOnce;

    [Header("Select the control button to hide for this AR experience")]
    public bool HideFlipButton;
    public bool HideSpinButton;
    public bool HideMuteButton;
    public bool HideSizeButton;

    GameObject spin;
    GameObject spin2;
    GameObject flip;
    GameObject mute;
    GameObject size;

    // Start is called before the first frame update
    void Start()
    {
		if (GameObject.Find("SPIN")){spin = GameObject.Find("SPIN");}
        if (GameObject.Find("SPIN2")) { spin2 = GameObject.Find("SPIN2"); }
        if (GameObject.Find("FLIP")) { flip = GameObject.Find("FLIP"); }
        if (GameObject.Find("mute")) { mute = GameObject.Find("mute"); }
        if (GameObject.Find("Size")) { size = GameObject.Find("Size"); }
    }

    // Update is called once per frame
    void Update()
    {
       if (!UIOverrideRunOnce)
		{
            if (GameObject.Find("SPIN") && HideSpinButton == true)
            { spin = GameObject.Find("SPIN");
                spin.SetActive(false);
                UIOverrideRunOnce = true;
            }

            if (GameObject.Find("SPIN2")&& HideSpinButton == true)
            { spin2 = GameObject.Find("SPIN2");
                spin2.SetActive(false);
                UIOverrideRunOnce = true;
            }

            if (GameObject.Find("FLIP")&& HideFlipButton == true)
            { flip = GameObject.Find("FLIP");
                flip.SetActive(false);
                UIOverrideRunOnce = true;
            }

            if (GameObject.Find("mute")&& HideMuteButton == true)
            { mute = GameObject.Find("mute");
                mute.SetActive(false);
                UIOverrideRunOnce = true;
            }

            if (GameObject.Find("Size") && HideSizeButton == true)
            {
                size = GameObject.Find("Size");
                size.SetActive(false);
                UIOverrideRunOnce = true;
            }

        }

    }
}
