/// <summary>
        /// Cambiar el valor de interaccion del boton dependiendo de las variables de cada target
        /// </summary>
        /// <param name="modelsTarget">Arreglo de todos los modelos en pantalla</param>
        public void SetInteractableBttnsTracket(ModelTarget[] modelsTarget)
        {
            ButtonTarget[] bttnsTarget = GetComponentsInChildren <ButtonTarget>();

            foreach (ModelTarget m in modelsTarget)
            {
                ButtonTarget bttnTarget = bttnsTarget.First((bTarget) => bTarget.IdTarget == m.Id);

                bool isInteractable = (m.isOverlap) ? true : !m.IsActive;
                bttnTarget.setInteractable(true);
            }
        }
Exemple #2
0
        /// <summary>
        /// Crear los botones para cambiar de modelos.
        /// </summary>
        /// <param name="modelControl">Objeto que contiene los modelos y su informacion</param>
        public void FillBttnsTracket(ModelARControl modelControl)
        {
            bttnResetRotation.onClick.RemoveAllListeners();
            bttnResetRotation.onClick.AddListener(() => modelControl.ResetRotation());

            foreach (Transform child in ContentBttns)
            {
                Destroy(child.gameObject);
            }

            ModelTarget[] modelsTarget = modelControl.modelsTarget;

            // Obtener largo de acuerdo a la cantidad de botones
            float bttWidth = getButtonWidth(modelsTarget.Length);

            foreach (ModelTarget m in modelsTarget)
            {
                ButtonTarget bttnTarget = Instantiate(prefBttonSelect, ContentBttns).GetComponent <ButtonTarget>();
                bttnTarget.setListenerButton(modelControl, m);

                bttnTarget.GetComponent <LayoutElement>().preferredWidth = bttWidth;
            }
        }