public void Initialize()
        {
            if (isInitialized)
            {
                Debug.Log("Building Carousel.");
                CleanUp();
            }

            GenerateDisplays(displayCasePrefab, shaderModelPrefab, materials.materials.Count);

            // Swap materials on each model
            for (int _i = 0; _i < displays.Count; _i++)
            {
                DisplayCase _display = displays[_i];
                _display.ChangeModelMaterial(materials.materials[_i]);
                _display.gameObject.name = "Display Case: " + _display.GetModelRenderer().sharedMaterial.shader;
            }

            startPosition = transform.position;

            displayCaseSelector.Initialize(displays);
            displayCaseSelector.onSelectionChange += OnSelectionChange;

            isInitialized = true;
        }
Exemplo n.º 2
0
        private void OnSelectionChange(DisplayCase _previousCase, DisplayCase _currentCase)
        {
            if (_currentCase == null)
            {
                text.enabled = false;
                return;
            }

            text.enabled = true;
            text.text    = _currentCase.GetModelRenderer().sharedMaterial.shader.ToString();
        }