예제 #1
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;
             * }
             */
        }
        protected virtual void Start()
        {
            mTrackableBehaviour = GetComponent <TrackableBehaviour>();
            if (mTrackableBehaviour)
            {
                mTrackableBehaviour.RegisterTrackableEventHandler(this);
            }

            initialScale = ChildTransform.localScale;

            _mARControl    = GetComponent <ModelARControl>();
            _touchRotation = GetComponent <TouchRotation>();
        }
예제 #3
0
        /// <summary>
        /// Modificar la informacion y listener del boton
        /// </summary>
        /// <param name="mControl"></param>
        /// <param name="mTarget"></param>
        public void setListenerButton(ModelARControl mControl, ModelTarget mTarget)
        {
            if (bttnTarget == null)
            {
                bttnTarget = GetComponent <Button>();
            }

            setId(mTarget.Id);

            // Cambiar nombre boton
            bttnTarget.GetComponentInChildren <TextMeshProUGUI>().text = mTarget.Name;

            bttnTarget.onClick.AddListener(() => mControl.setActiveModel(mTarget.Id));
            bttnTarget.onClick.AddListener(() => ARManager.Instance.ChangeModelTarget(mControl));

            bool isInteractable = (mTarget.isOverlap) ? true : !mTarget.IsActive;

            bttnTarget.interactable = true;
        }
예제 #4
0
 public void ChangeModelTarget(ModelARControl mARControl)
 {
     //_ARMenu.SetInteractableBttnsTracket(mARControl.modelsTarget);
 }