Exemplo n.º 1
0
        /// <summary>
        /// Cargar los materiales asociados al  OptotipoEnum y asignarlos al controlador de la opcion
        /// </summary>
        public void AsignarMateriales(GameObject opcion, OptotipoEnum optotipo)
        {
            // Obtenemos el controlador y el rederizador
            OptotipoController controller = opcion.GetComponent <OptotipoController> ();
            Renderer           render     = opcion.GetComponent <Renderer> ();

            // Material cuando no esta siendo observado
            Material inactiveMaterial = Resources.Load("Materials/" + optotipo, typeof(Material)) as Material;

            render.material = inactiveMaterial;

            // Material cuando esta siendo observado
            Material gazedAtMaterial = Resources.Load("Materials/" + optotipo + "_seleccionado", typeof(Material)) as Material;

            // Si el controlador no es nulo, es una de nuestras opciones disponibles
            if (controller != null)
            {
                controller.inactiveMaterial = inactiveMaterial;
                controller.gazedAtMaterial  = gazedAtMaterial;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Asignar el valor del optotipo que representa el objeto en la escena
        /// </summary>
        public void AsignarValorOptotipo(GameObject gameObject, OptotipoEnum optotipo)
        {
            OptotipoController controller = gameObject.GetComponent <OptotipoController> ();

            controller.optotypeValue = optotipo;
        }